bugfix: adding static objects will 'replace' previously added static object in game...
[blender-staging.git] / source / gameengine / Physics / Bullet / CcdPhysicsController.cpp
index ecb6c8d9dcf453c18d1aa07d93f138dd7c8c4909..5a45ce020cce3cc8e940f416abba587d966b594f 100644 (file)
@@ -104,12 +104,13 @@ public:
 
 };
 
+
 void CcdPhysicsController::CreateRigidbody()
 {
 
-       btTransform trans = GetTransformFromMotionState(m_cci.m_MotionState);
+       btTransform trans = GetTransformFromMotionState(m_MotionState);
 
-       m_bulletMotionState = new BlenderBulletMotionState(m_cci.m_MotionState);
+       m_bulletMotionState = new BlenderBulletMotionState(m_MotionState);
 
        m_body = new btRigidBody(m_cci.m_mass,
                m_bulletMotionState,
@@ -329,6 +330,7 @@ void                CcdPhysicsController::setOrientation(float quatImag0,float quatImag1,float
        btTransform xform  = m_body->getCenterOfMassTransform();
        xform.setRotation(btQuaternion(quatImag0,quatImag1,quatImag2,quatReal));
        m_body->setCenterOfMassTransform(xform);
+       m_bulletMotionState->setWorldTransform(xform);
 
 }
 
@@ -339,10 +341,13 @@ void              CcdPhysicsController::setPosition(float posX,float posY,float posZ)
        {
                m_body->setCollisionFlags(m_body->getCollisionFlags() | btCollisionObject::CF_KINEMATIC_OBJECT);
        }
+       
        m_MotionState->setWorldPosition(posX,posY,posZ);
        btTransform xform  = m_body->getCenterOfMassTransform();
        xform.setOrigin(btVector3(posX,posY,posZ));
        m_body->setCenterOfMassTransform(xform);
+       m_bulletMotionState->setWorldTransform(xform);
+
 
 }
 void           CcdPhysicsController::resolveCombinedVelocities(float linvelX,float linvelY,float linvelZ,float angVelX,float angVelY,float angVelZ)