Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorMitchell Stokes <mogurijin@gmail.com>2012-09-13 04:46:50 +0400
committerMitchell Stokes <mogurijin@gmail.com>2012-09-13 04:46:50 +0400
commit3e4b353cfa7258a6678252db4d382094782f42f7 (patch)
tree4820fb9da2528ae7a4061d2094decede0cb322b5 /source
parent12da3d999ba45bc33a12bd378674d950c19d30f1 (diff)
BGE: LibLoaded sensors that made use of physics controllers (touch, collision) could cause various physics problems (like infinite loops in Bullet, etc). This happened because their KX_TouchEventManagers were merged prior to having their physics controllers merged, which has now been fixed. Thanks to Kupoman for hunting down the fix!
Diffstat (limited to 'source')
-rw-r--r--source/gameengine/Ketsji/KX_Scene.cpp13
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