Finding the normals of an oriented bounding box?
Posted
by
Milo
on Game Development
See other posts from Game Development
or by Milo
Published on 2012-11-11T00:01:16Z
Indexed on
2012/11/11
5:28 UTC
Read the original article
Hit count: 375
geometry
|collision-detection
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:
How do I determine which edges the car is penetrating.
I know how to determine the normal of an edge, but how do I know if I need (-dy, dx) or (dy, -dx)?
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
© Game Development or respective owner