[SOLVED] impulse no effect on stopped object (deactivation)

randomlord

17-05-2013 01:56:28

Hi guys

I'm kinda new to bullet and i

I have a static plane (you know, the ground of the world), defined like this:


OgreBulletCollisions::CollisionShape *basePlaneShape = new OgreBulletCollisions::StaticPlaneCollisionShape(Ogre::Vector3(0,1,0), 0);
OgreBulletDynamics::RigidBody *basePlaneBody = new OgreBulletDynamics::RigidBody("BasePlane", mWorld);
basePlaneBody->setStaticShape(basePlaneShape, 0.6, 0.6);


now, when there is another object (say a ball) that lies on that plane i can't aplly any impulse/force on it, it just doesn't move anymore.
So when i create a ball like this


Entity *entity = mSceneMgr->createEntity("sphere.mesh");

SceneNode* node = mSceneMgr->getRootSceneNode()->createChildSceneNode("testball");
node->attachObject(entity);
node->scale(0.002, 0.002, 0.002);

float radius = ((entity->getBoundingBox().getSize() * 0.002).x)/2;

OgreBulletCollisions::SphereCollisionShape* ballShape = new OgreBulletCollisions::SphereCollisionShape(radius);
mRigidBody = new OgreBulletDynamics::RigidBody( "testballRB", mWorld);
mRigidBody->setShape( node, ballShape, 0.6f, 0.6f, 0.2f, Vector3(0,10,-5),Quaternion(0,0,0,1));


and aplly an impulse with


mRigidBody->applyImpulse(Vector3(0.5,0.5,0.5), Vector3(0,0,0));


That works perfectly when the ball is dropping out of the sky and boucing up from the floor, but once it is done bouncing and lies on the floor, the apllyImpulse() just has no effect anymore.
So when the rigid bodies are in contact with that static plane, its like they're gluded to that surface and no impulse or force can move that object anymore.

Now my question is what i am doing wrong that the impulses and the forces don't work anymore?
Anyone that has an idee how to get this to work?

EDIT:
Is it possible that is has something to do with the fact that as long as the ball is moving, the impulse has an effect, and from the moment the ball is lying still the impulse doesn't has any effect anymore?

Thx

AlexeyKnyshev

17-05-2013 04:52:45

Auto deactivating... Simply disable it!

randomlord

21-05-2013 20:14:22

Problem solved =)
Thanks Alexey!

AlexeyKnyshev

22-05-2013 12:26:53

Plz, mark topic as [SOLVED] (before topic name).

P.S. For future. If you have long life dynamic object, i.e. user-controlled car, hero and so on, you can disable deactivation on it. But for another rigid bodies it would be better to disable deactivation before adding impulse/velocity and activate again after all.