# Finding the normals of an oriented bounding box?

Here is my problem.

I'm working on the physics for my 2D game.

All objects are oriented bounding boxes (OBB) based on the separate axis theorem.

In order to do collision resolution, I need to be able to get an object out out of the object it is penetrating.

To do this I need to find the normal of the face(s) that the other OBB is touching.

Example:

The small red OBB is a car lets say, and the big OBB is a static building. I need to determine the unit vector that is the normal of the building edge(s) the car is penetrating to get the car out of there.

Here are my questions:

1. How do I determine which edges the car is penetrating.

2. I know how to determine the normal of an edge, but how do I know if I need (-dy, dx) or (dy, -dx)?

3. In the case I'm demonstrating the car is penetrating 2 edges, which edge(s) do I use to get it out?

Answers or help with any or all of these is greatly appreciated.

Thank you

• This is clearly a problem in programing (and game programing in particular). I mean, seriously, your title mentions a programming construct (a bounding box) and does not mention a physics concept. I'll contact the mods at GameDev.SE to see if they want it.
– dmckee
Nov 11, 2012 at 0:32