Game Development Community

How to check when objects are no longer colliding?

by Richard Skala · in iTorque 2D · 03/02/2011 (4:23 pm) · 3 replies

I have a situation when Object A collides with Object B, collision is turned off Object B to avoid repeated collision callbacks, since something happens specifically on collision. I need to turn collision back on Object B, but not until Object A is sufficiently far enough away from Object B, so they can possibly collide again.

How can I check if the collision of Object A no longer intersects with the collision of Object B?

#1
03/02/2011 (7:30 pm)
circle raycast sounds like a way or storing the "colling other side" in a simset on object b and check the position of B vs every object in the simset. when it can collide again, remove the object from the simset (this is kind of spatial space knowledge / interest management)

To do so, just ensure to fire a schedule, DO NOT USE THE UPDATE CALLBACK ;)
Otherwise you could save all the effort as the update callback on average will be a hell a lot worse than just leaving the collision as is ;)
#2
03/02/2011 (9:22 pm)
I have done this before by calling a schedule on collision that measures distance. If distance between A and B is > XY, turn on collisions of B.
#3
03/03/2011 (5:34 pm)
Thanks for the input guys -- I will try out these ideas.