From 36d0e2649ee8bc95d68e5d8e5317aee4e82e44bf Mon Sep 17 00:00:00 2001 From: Benoit Bolsee Date: Thu, 30 Apr 2009 20:02:22 +0000 Subject: [PATCH] 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. --- source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp index 3e1e0294321..a0bf0448e3e 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp @@ -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()); }