diff options
author | Porteries Tristan <republicthunderbolt9@gmail.com> | 2015-08-10 15:36:54 +0300 |
---|---|---|
committer | Porteries Tristan <republicthunderbolt9@gmail.com> | 2015-08-10 18:08:11 +0300 |
commit | 3c77822f96e6ef6972c3a87467a4941d7a114744 (patch) | |
tree | 138a4d7d378e0492f070b6068ccb7123b6b7ea1e /source | |
parent | 0c82ba4213577c1b02b2060888f8c43c265c1637 (diff) |
BGE: Fix T19377 restore dynamics after unparenting object.
Reviewers: scorpion81
Diffstat (limited to 'source')
-rw-r--r-- | source/gameengine/Ketsji/KX_GameObject.cpp | 6 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp | 4 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_Scene.cpp | 4 | ||||
-rw-r--r-- | source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp | 5 |
4 files changed, 14 insertions, 5 deletions
diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index 7021d527abb..c3da80bc14f 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -1616,7 +1616,8 @@ void KX_GameObject::Resume(void) { if (m_suspended) { SCA_IObject::Resume(); - if (GetPhysicsController()) + // Child objects must be static, so we block changing to dynamic + if (GetPhysicsController() && !GetParent()) GetPhysicsController()->RestoreDynamics(); m_suspended = false; @@ -3438,7 +3439,8 @@ PyObject *KX_GameObject::PySuspendDynamics(PyObject *args) PyObject *KX_GameObject::PyRestoreDynamics() { - if (GetPhysicsController()) + // Child objects must be static, so we block changing to dynamic + if (GetPhysicsController() && !GetParent()) GetPhysicsController()->RestoreDynamics(); Py_RETURN_NONE; } diff --git a/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp b/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp index e02eca3db63..96e1cc29de3 100644 --- a/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp +++ b/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp @@ -121,7 +121,9 @@ bool KX_SCA_DynamicActuator::Update() switch (m_dyn_operation) { case 0: - controller->RestoreDynamics(); + // Child objects must be static, so we block changing to dynamic + if (!obj->GetParent()) + controller->RestoreDynamics(); break; case 1: controller->SuspendDynamics(); diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp index fd709a87def..83126e88ce5 100644 --- a/source/gameengine/Ketsji/KX_Scene.cpp +++ b/source/gameengine/Ketsji/KX_Scene.cpp @@ -584,6 +584,10 @@ KX_GameObject* KX_Scene::AddNodeReplicaObject(class SG_IObject* node, class CVal newctrl->SetNewClientInfo(newobj->getClientInfo()); newobj->SetPhysicsController(newctrl, newobj->IsDynamic()); newctrl->PostProcessReplica(motionstate, parentctrl); + + // Child objects must be static + if (parent) + newctrl->SuspendDynamics(); } return newobj; diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp index 759e8bd6f7e..53c007f256c 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp @@ -3122,9 +3122,7 @@ void CcdPhysicsEnvironment::ConvertObject(KX_GameObject *gameobj, RAS_MeshObject { KX_BlenderSceneConverter *converter = (KX_BlenderSceneConverter*)KX_GetActiveEngine()->GetSceneConverter(); parent = converter->FindGameObject(blenderparent); - isbulletdyna = false; isbulletsoftbody = false; - shapeprops->m_mass = 0.f; } if (!isbulletdyna) @@ -3581,6 +3579,9 @@ void CcdPhysicsEnvironment::ConvertObject(KX_GameObject *gameobj, RAS_MeshObject } } + if (parent) + physicscontroller->SuspendDynamics(false); + CcdPhysicsController* parentCtrl = parent ? (CcdPhysicsController*)parent->GetPhysicsController() : 0; physicscontroller->SetParentCtrl(parentCtrl); |