Bullet: Physics stop working after some time

I have been working with Bullet lately and I noticed that if I leave my scene alone for a few seconds the physics simply stop working, if I turn the debug on the wire-frame of the object I’m manipulating turns from white to green when the physics stop. After this happens nothing can move the object at all.

I also noticed that this only happens if I leave it alone until it completely stops, if I keep applying forces to it, it works as I expected. It also happens even if the debug is turned off.

This is a very usefull mechanism (available in all physics engines) to keep the CPU load low. It is called “deactivation” or “sleeping”.

The very first sample from the bullet_samples.zip shows how to either disable deactivation for individual bodies, or activate them again before applying forces. Bodies asleep which get pushed wake up automatically.

Also have a look at the API documentation for methods which control the linear/angular velocity limits for deactivation.

2 Likes

Hey enn0x, thanks for your help again, but the bullet_samples.zip link on the manual is broken.

I think this information should be in the manual. By the way why isn’t the manual a wiki yet? I don’t have enough experience with C++ to help with the development of Panda but I could help improving the manual as I learn.

We have to wait until the servers are back again…