BGE bug fix: when a dynamic object is parented to a compound shape and then unparented, it jumps at the position it had before the parenting.

This commit is contained in:
2009-04-30 20:02:22 +00:00
parent 2ec50d7bb2
commit 36d0e2649e

View File

@@ -533,6 +533,12 @@ void CcdPhysicsEnvironment::enableCcdPhysicsController(CcdPhysicsController* ctr
{
btCollisionObject* obj = ctrl->GetCollisionObject();
obj->setUserPointer(ctrl);
// update the position of the object from the user
if (ctrl->GetMotionState())
{
btTransform xform = CcdPhysicsController::GetTransformFromMotionState(ctrl->GetMotionState());
ctrl->SetCenterOfMassTransform(xform);
}
m_dynamicsWorld->addCollisionObject(obj,
ctrl->GetCollisionFilterGroup(), ctrl->GetCollisionFilterMask());
}