From 0c14a897dd92cba317f2466f39ef5782b823b31c Mon Sep 17 00:00:00 2001 From: Porteries Tristan Date: Tue, 7 Jul 2015 13:36:47 +0200 Subject: BGE: Fix wrong current logic manager in collision callback. --- source/gameengine/Ketsji/KX_GameObject.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'source/gameengine/Ketsji/KX_GameObject.cpp') diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index d98669cc5b4..eabe0765d3b 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -1583,6 +1583,14 @@ void KX_GameObject::RunCollisionCallbacks(KX_GameObject *collider, const MT_Vect if (!m_collisionCallbacks || PyList_GET_SIZE(m_collisionCallbacks) == 0) return; + /** Current logic controller is set by each python logic bricks before run, + * but if no python logic brick ran the logic manager can be wrong + * (if the user use muti scenes) and it will cause problems with function + * ConvertPythonToGameObject which use the current logic manager for object's name. + * Note: the scene is already set in logic frame loop. + */ + SCA_ILogicBrick::m_sCurrentLogicManager = GetScene()->GetLogicManager(); + PyObject *args[] = {collider->GetProxy(), PyObjectFrom(point), PyObjectFrom(normal)}; RunPythonCallBackList(m_collisionCallbacks, args, 1, ARRAY_SIZE(args)); -- cgit v1.2.3