OnCollision and OnSeparation is called all the time by non-colliding Geom

Jan 28, 2009 at 1:38 PM
Edited Jan 28, 2009 at 1:38 PM
Hi!

i want to determine only the events when a Geom starts colliding with another and when it stops colliding. so i listen to the OnCollision and OnSeparation and check if the collision status has changed. this works fine as long as i return true in OnCollision, but i need a Geom which checks collision but doesn't actually collide physically. with OnCollision return false i always get OnCollision and OnSeparation events even though the Geom is still intersecting with another Geom. why is that?

private bool OnCollision( Geom self, Geom other, ContactList contactList )
{
    if( !isColliding )
    {
        isColliding = true;
        // handle collision start
    }
    
    return false;
}

private void OnSeparation( Geom self, Geom other )
{
    if( isColliding )
    {
        isColliding = false;
        // handle collision end
    }
}
Jan 29, 2009 at 2:38 AM
as far as a geom that only senses collisions, you should use the geom.IsSensor property. about your other problem, i don't see why it should be doing that but i havent much experience with the OnCollision and OnSeparation events.