Hi
first of all I hope that I didnt miss any previous posts if someone had the same problem before.
Im working on a game and want to simulate this "Wooden Labyrinth Puzzle" with a marble rolling through a labyrinth. I tried to wrap the physics in an own class and everything is somehow working fine....well except for the fact that if I dont provide any userinput for a few seconds the simulation simply stops. This can can stop the ball while moving immediately. As long as I keep spaming for example keyboard inputs the ball keeps rolling.
When the simulation stops the programm is still running. I checked the WorldTransform data after the simulation stop and they are simply constant. The display-callBack function is still beeing called frequently (working with glut). I have no idea why the simulation stops.
Since I wraped the objects and the physics in an own class its hard to proivde some code but if any1 has an idea and needs to verify this on concrete code I can try to give the code for this.
(Working with glut and bullet 2.78)
Thx for your help!
Simulation stopping
-
- Posts: 5
- Joined: Thu Jun 16, 2011 11:44 am
Re: Simulation stopping
Hi!
Rigid bodies which don't move for a certain amount of time get automatically disabled in bullet for performance optimization.
So when creating your ball body you have to call:
In this way the ball will never enter in "sleeping" state 
Rigid bodies which don't move for a certain amount of time get automatically disabled in bullet for performance optimization.
So when creating your ball body you have to call:
Code: Select all
body->setActivationState(DISABLE_DEACTIVATION);

-
- Posts: 4
- Joined: Tue Jun 21, 2011 2:17 pm
Re: Simulation stopping
yay Thx for your fast help^^
Im glad you mentioned that because I never would ve noticed that <.<,
Everything is working fine now Thank you!
Im glad you mentioned that because I never would ve noticed that <.<,
Everything is working fine now Thank you!
-
- Posts: 237
- Joined: Tue Jun 29, 2010 10:27 pm
Re: Simulation stopping
For future reference, if you don't want to completely disable deactivation for your object (and in large/complex simulations, having deactivation enabled is often good for performance), but still need it to respond to manually applied forces, you can reactivate it right before force application by calling:
Though in the case of a simple labyrinth game, ologon's solution should be fine (and easier, being a one-time call).
Code: Select all
body->activate()