I have a RigidBody2D which is a ball and it’s initially asleep and floats in the air. I have another RigidBody2D which represents a player and I want to wake the ball when the player first hits it.
The problem is that the ball becomes awake also when the player gets close to it (+/- the ball’s radius) even without touching the ball. Why is this happening? Shouldn’t the ball become awake only after a collision? I checked the collision events and they’re not fired. Please, help me make it work as expected.
The 2D physics system (Box2D) wakes bodies when their AABB overlap i.e. “potentially overlapping” so contact evaluation can commence. You can go into the 2D physics settings and turn on “Show Collider AABB” to see these. For non-rotated boxes, the AABB perfectly aligns with the box but for other shapes and rotations, this isn’ the case.
In technical terms, a contact is created when the AABB overlap (known as the broadphase check). Each update, the contact is evaluated using the narrowphase check seeing if the collliders actually touch. The contact stays in existence until the AABB stop overlapping.