I’m trying to manually check whether my 2D collider has exited the bounds of another 2D collider.
Unity’s OnTriggerExit2D
gets called when my player’s isKinematic
is flipped on and off, so I need to double check and only run the code if the player’s collider is actually outside the box I’m checking it against.
I tried using Bounds.Intersects()
, but it returns true
when OnTriggerExit2D
is called. Now I’m wondering: is OnTriggerExit2D
called before the collider fully exits the trigger? How can I manually check this using bounds?
Changing the body-type is non-trivial and results in all contacts being destroyed and recreated next fixed-update. Lots of users change the body type all the time and it’s bad practice.
Either way, we have to catch this situation and tally-up destroyed contacts with ones potentially produced next update and figure out if ‘exit’ is required.
In this case, it’s a bug and there’s a fix for it on its way to the 5.3 patch release.
Try looking at the bounds which as you should easily be able to figure out, is just an AABB. It isn’t some complex exterior of a collider nor could it be with only a point and extent.