AABB - AABB Collision, which face do I hit?

Posted by PeeS on Game Development See other posts from Game Development or by PeeS
Published on 2012-03-22T08:55:06Z Indexed on 2012/03/22 11:39 UTC
Read the original article Hit count: 261

Filed under:
|
|

To allow my objects to slide when they collide, I need to :

  • Know which face of the AABB they collide with.
  • Calculate the normal to that face.
  • Return the normal and calculate the impulse that to apply to the player's velocity.

Question

How can I calculate which face of the AABB I collided with, knowing that I have two AABB's colliding? One is the player and the other is a world object.

Here's what that looks like (problem collision circled in white):

problem collision

Thank you for your help.

© Game Development or respective owner

Related posts about c++

Related posts about collision-detection