Patch provided by Carsten,

KX_RaySensor::Evaluate returns false when hit was detected and it was
already marked as hit.  (no change in state)

Kent
This commit is contained in:
Kent Mein 2007-02-19 21:46:57 +00:00
parent 316df82cb4
commit 6c17f1187e

@ -237,8 +237,8 @@ bool KX_RaySensor::Evaluate(CValue* event)
result = KX_RayCast::RayTest(spc, physics_environment, frompoint, topoint, resultpoint, resultnormal, KX_RayCast::Callback<KX_RaySensor>(this));
/* now pass this result to some controller */
if (m_rayHit)
{
if (!m_bTriggered)
@ -249,6 +249,8 @@ bool KX_RaySensor::Evaluate(CValue* event)
}
else
{
// notify logicsystem that ray is STILL hitting ...
result = false;
}
}
@ -257,11 +259,13 @@ bool KX_RaySensor::Evaluate(CValue* event)
if (m_bTriggered)
{
m_bTriggered = false;
// notify logicsystem that ray is not hitting anymore
// notify logicsystem that ray JUST left the Object
result = true;
}
}
return result;
}