How to completely disable/enable a btRigidBody
Posted: Tue Jun 07, 2016 5:54 pm
I have a simulation with a long chain of rigid bodies. It's almost working except I need to be able to disable most of the bodies most of the time. I am able to sort of do this by using forceActivationState(DISABLE_SIMULATION) and later enable them with forceActivationState(ACTIVE_TAG). This causes disabled bodies to be disconnected from one another, however they appear to still be colliding with one another and still getting influenced by bodies that have not been disabled. Also, the amount of CPU time used stays high as if all bodies are active in the simulation.
I tried btDiscreteDynamicsWorld::removeRigidBody() to completely remove bodies from the simulation, but it causes an assertion in Bullet.
Also tried btDiscreteDynamicsWorld::removeConstraint() to explicitly remove the constraints connected to disabled bodies. This causes the whole simulation to go very unstable very fast.
Is there a correct way to remove bodies from and insert them back into the simulation?
I tried btDiscreteDynamicsWorld::removeRigidBody() to completely remove bodies from the simulation, but it causes an assertion in Bullet.
Also tried btDiscreteDynamicsWorld::removeConstraint() to explicitly remove the constraints connected to disabled bodies. This causes the whole simulation to go very unstable very fast.
Is there a correct way to remove bodies from and insert them back into the simulation?