How can I get accurate collision resolution on the corners of rectangles?

Posted by ssb on Game Development See other posts from Game Development or by ssb
Published on 2012-11-25T14:22:10Z Indexed on 2012/11/25 17:21 UTC
Read the original article Hit count: 244

I have a working collision system implemented, and it's based on minimum translation vectors. This works fine in most cases except when the minimum translation vector is not actually in the direction of the collision.

For example:

Ledge collision

When a rectangle is on the far edge on any side of another rectangle, a force can be applied, in this example down, the pushes one rectangle into the other, particularly a static object like a wall or a floor. As in the picture, the collision is coming from above, but because it's on the very edge, it translates to the left instead of back up. I've searched for a while to find an approach but everything I can find deals with general corner collisions where my problem is only in this one limited case.

Any suggestions?

© Game Development or respective owner

Related posts about collision-resolution

Related posts about separating-axis-theorem