diff options
Diffstat (limited to 'source/gameengine/Ketsji/KX_Scene.cpp')
-rw-r--r-- | source/gameengine/Ketsji/KX_Scene.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp index f9fa0ae65f1..c1afed82b02 100644 --- a/source/gameengine/Ketsji/KX_Scene.cpp +++ b/source/gameengine/Ketsji/KX_Scene.cpp @@ -1727,11 +1727,6 @@ static void MergeScene_LogicBrick(SCA_ILogicBrick* brick, KX_Scene *to) brick->Replace_IScene(to); brick->Replace_NetworkScene(to->GetNetworkScene()); - SCA_ISensor *sensor= dynamic_cast<class SCA_ISensor *>(brick); - if (sensor) { - sensor->Replace_EventManager(logicmgr); - } - /* near sensors have physics controllers */ #ifdef USE_BULLET KX_TouchSensor *touch_sensor = dynamic_cast<class KX_TouchSensor *>(brick); @@ -1739,6 +1734,14 @@ static void MergeScene_LogicBrick(SCA_ILogicBrick* brick, KX_Scene *to) touch_sensor->GetPhysicsController()->SetPhysicsEnvironment(to->GetPhysicsEnvironment()); } #endif + + // If we end up replacing a KX_TouchEventManager, we need to make sure + // physics controllers are properly in place. In other words, do this + // after merging physics controllers! + SCA_ISensor *sensor= dynamic_cast<class SCA_ISensor *>(brick); + if (sensor) { + sensor->Replace_EventManager(logicmgr); + } } #ifdef USE_BULLET |