schteppe / p2.js

JavaScript 2D physics library
Other
2.63k stars 330 forks source link

Collision between circle and box can be missed #372

Open mqnc opened 7 months ago

mqnc commented 7 months ago

image

In the depicted case, the collision is missed. For each edge of the convex shape (box), the engine looks for the point on the circle that is furthest in the direction which is normal to the edge and checks whether it is inside the convex. This is not the case for any edge in the depicted scenario. It will successfully detect the collision if the circle slowly moves into the box but if the circle exceeds the back wall of the box in one step, the collision will be missed.