diff options
Diffstat (limited to 'source/gameengine')
-rw-r--r-- | source/gameengine/Ketsji/KX_NearSensor.cpp | 33 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_NearSensor.h | 3 |
2 files changed, 22 insertions, 14 deletions
diff --git a/source/gameengine/Ketsji/KX_NearSensor.cpp b/source/gameengine/Ketsji/KX_NearSensor.cpp index f7baacdfa61..c6a6304cb2c 100644 --- a/source/gameengine/Ketsji/KX_NearSensor.cpp +++ b/source/gameengine/Ketsji/KX_NearSensor.cpp @@ -142,6 +142,22 @@ KX_NearSensor::~KX_NearSensor() delete m_client_info; } +void KX_NearSensor::SetPhysCtrlRadius() +{ + if (m_bTriggered) + { + if (m_physCtrl) + { + m_physCtrl->SetRadius(m_ResetMargin); + } + } else + { + if (m_physCtrl) + { + m_physCtrl->SetRadius(m_Margin); + } + } +} bool KX_NearSensor::Evaluate() { @@ -151,20 +167,9 @@ bool KX_NearSensor::Evaluate() if (m_bTriggered != m_bLastTriggered) { m_bLastTriggered = m_bTriggered; - if (m_bTriggered) - { - if (m_physCtrl) - { - m_physCtrl->SetRadius(m_ResetMargin); - } - } else - { - if (m_physCtrl) - { - m_physCtrl->SetRadius(m_Margin); - } - - } + + SetPhysCtrlRadius(); + result = true; } diff --git a/source/gameengine/Ketsji/KX_NearSensor.h b/source/gameengine/Ketsji/KX_NearSensor.h index 03d6f830579..4f0247d209d 100644 --- a/source/gameengine/Ketsji/KX_NearSensor.h +++ b/source/gameengine/Ketsji/KX_NearSensor.h @@ -68,6 +68,7 @@ public: virtual void SynchronizeTransform(); virtual CValue* GetReplica(); virtual void ProcessReplica(); + virtual void SetPhysCtrlRadius(); virtual bool Evaluate(); virtual void ReParent(SCA_IObject* parent); @@ -91,6 +92,8 @@ public: if (sensor->m_Margin > sensor->m_ResetMargin) sensor->m_ResetMargin = sensor->m_Margin; + sensor->SetPhysCtrlRadius(); + return 0; } |