svn merge -r 16411:16453 https://svn.blender.org/svnroot/bf-blender/trunk/blender
[blender.git] / source / gameengine / Physics / Bullet / CcdPhysicsEnvironment.cpp
index 228709999a5fcdc885bdae6448a89da9a2600e4d..0747761ea0ad1efc9a97db02b8f7d8178f6028ae 100644 (file)
@@ -443,11 +443,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