diff options
Diffstat (limited to 'source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp')
-rw-r--r-- | source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp index d14ddf8f65c..d3b83a74439 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp @@ -452,11 +452,12 @@ void CcdPhysicsEnvironment::updateCcdPhysicsController(CcdPhysicsController* ctr // this function is used when the collisionning group of a controller is changed // remove and add the collistioning object btRigidBody* body = ctrl->GetRigidBody(); - btVector3 inertia; + btVector3 inertia(0.0,0.0,0.0); m_dynamicsWorld->removeCollisionObject(body); body->setCollisionFlags(newCollisionFlags); - body->getCollisionShape()->calculateLocalInertia(newMass, inertia); + if (newMass) + body->getCollisionShape()->calculateLocalInertia(newMass, inertia); body->setMassProps(newMass, inertia); m_dynamicsWorld->addCollisionObject(body, newCollisionGroup, newCollisionMask); // to avoid nasty interaction, we must update the property of the controller as well |