I would like to make an existing (already added to the simulation) static or kinematic shape behave like a dynamic one at a certain point. Here is what I tried:
Code: Select all
float mass = 500.0f;
btVector3 localInertia(btScalar(0), btScalar(0), btScalar(0));
m_body->getCollisionShape()->calculateLocalInertia(btScalar(mass), localInertia);
m_body->setMassProps(mass, localInertia);
m_body->setCollisionFlags(0);
m_body->setGravity(btVector3(btScalar(0), btScalar(-9.8), btScalar(0)));
m_body->forceActivationState(0);
m_body->activate();
Also I wonder about the gravity. Is there an elegant way to give the body the same gravity as specified in the dynamicsWorld? I haven't yet checked how bullet handles gravity. Maybe if I manually set the gravity for all (dynamic/kinematic/static) bodies when I add them to the world it won't change their behavior but they will automatically have the gravity ready once they become dynamic. What do you think?
Thanks for any help.