However, I'm trying to set an object's mass after the rigidbody has been constructed. For example, I have a dynamic object with mass 1 that I want to become static. My goal is to be able to say something like: object->setMass(0) and have bullet update the rigidbody mass appropriately (and this should work after the rigidbody has been added to the world).
Here is what I have tried:
- rigidBody->setMassProps(0,btVector3(0,0,0));
This successfully made the object static, but then the collision detection for that object started to mess up (objects started to slide along the top of the object and dip into its side).
rigidBody->setCollisionFlags(rigidBody->getCollisionFlags() | btCollisionObject::CF_STATIC_OBJECT);
This successfully made the object static, but like my other attempt the collisions started to mess up. Objects would partially go through and get stuck in the middle.
So, is there a way to set an object's mass (or make it static) after the rigidbody has been constructed and after the object has been added to the world? Is there something about mass in bullet that I don't understand?