So lets say the event happens when the camera is <= 10.0f from a node in the if statement it fires once, then the node moves away, later comes below the distance again but the event doesn't happen again.
Code: Select all
while (device->run())
if (device->isWindowActive())
{
f32 distance = node->getAbsolutePosition().getDistanceFrom(camera->getAbsolutePosition());
if( distance <= 10.0f)
{
// sound plays here
}
else if ( distance >10.0f )
{
/// nothing here yet trying to perfect this
}
}