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,9 +237,9 @@ 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_rayHit)
{
if (!m_bTriggered)
{
@ -248,19 +248,23 @@ bool KX_RaySensor::Evaluate(CValue* event)
m_bTriggered = true;
}
else
{
}
{
// notify logicsystem that ray is STILL hitting ...
result = false;
}
}
else
{
else
{
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;
}