diff options
-rw-r--r-- | source/gameengine/GameLogic/SCA_ISensor.h | 4 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_NearSensor.cpp | 6 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_TouchSensor.cpp | 5 |
3 files changed, 10 insertions, 5 deletions
diff --git a/source/gameengine/GameLogic/SCA_ISensor.h b/source/gameengine/GameLogic/SCA_ISensor.h index 0d65270dc7b..d1872009291 100644 --- a/source/gameengine/GameLogic/SCA_ISensor.h +++ b/source/gameengine/GameLogic/SCA_ISensor.h @@ -116,8 +116,8 @@ public: /** set the level detection on or off */ void SetLevel(bool lvl); - void RegisterToManager(); - void UnregisterToManager(); + virtual void RegisterToManager(); + virtual void UnregisterToManager(); virtual float GetNumber(); diff --git a/source/gameengine/Ketsji/KX_NearSensor.cpp b/source/gameengine/Ketsji/KX_NearSensor.cpp index 397aedb3fa3..bae87c28123 100644 --- a/source/gameengine/Ketsji/KX_NearSensor.cpp +++ b/source/gameengine/Ketsji/KX_NearSensor.cpp @@ -252,8 +252,10 @@ bool KX_NearSensor::NewHandleCollision(void* obj1,void* obj2,const PHY_CollData client_info->m_gameobject : NULL); - // these checks are done already in BroadPhaseFilterCollision() - if (gameobj /*&& (gameobj != parent)*/) + // Add the same check as in SCA_ISensor::Activate(), + // we don't want to record collision when the sensor is not active. + if (m_links && !m_suspended && + gameobj /* done in BroadPhaseFilterCollision() && (gameobj != parent)*/) { if (!m_colliders->SearchValue(gameobj)) m_colliders->Add(gameobj->AddRef()); diff --git a/source/gameengine/Ketsji/KX_TouchSensor.cpp b/source/gameengine/Ketsji/KX_TouchSensor.cpp index 2802da2723d..1935a0bde39 100644 --- a/source/gameengine/Ketsji/KX_TouchSensor.cpp +++ b/source/gameengine/Ketsji/KX_TouchSensor.cpp @@ -184,7 +184,10 @@ bool KX_TouchSensor::NewHandleCollision(void*object1,void*object2,const PHY_Coll client_info->m_gameobject : NULL); - if (gameobj && (gameobj != parent) && client_info->isActor()) + // add the same check as in SCA_ISensor::Activate(), + // we don't want to record collision when the sensor is not active. + if (m_links && !m_suspended && + gameobj && (gameobj != parent) && client_info->isActor()) { if (!m_colliders->SearchValue(gameobj)) m_colliders->Add(gameobj->AddRef()); |