I am trying to write a physics simulator and have had a problem for weeks now.

I have two oriented bounding boxes in 3D space. An oriented bounding box is just a box of any dimension, location, and orientation. I am able to tell when these two boxes are intersecting by using the separating axis theorem.

However once they have intersected I want them to respond in a physically realistic way. In order for them to do so I need to know the point of intersection between the boxes. Before I can explain what this point is I need to explain what the normal of the collision is.

The separating axis theorem tests if the boxes are overlapping. If they are then there is no axis (x,y,z,u,w,etc) in 3D space that can separate them, ie you can't draw a line between them that would separate the boxes. The collision normal would be the axis on which the two bounding boxes overlap the least. For instance imagine that two identical cubes were lined up perfectly on the y and z axes but separated on the x axis so that they weren't touching. If they started to move towards each other on the x axis and finally came to overlap one another a bit the x axis would be the collision normal since it is the axis on which there is the least amount of overlap between the two cubes.

Now getting back to the point of intersection. This point would be the point that is on the collision normal and in between the depth of overlap between the two boxes on the axis of the collision normal. Going back to the cube example it would be the point found by averaging their x positions. Of course this point is not so easy to find when it comes to oriented bounding boxes as they can be unequal in size, rotated in any which way, and probably won't be lined up perfectly on any specific axis.

I would like to know any general method for finding this point. All I know is the location of each boxes center, the locations of their vertices, and their orientation (ie how they are rotated) which I am storing as a 3x3 matrix. Each row/column of the matrix represents one arbitrary axis which describes the rotation of the box. Finally I know a unit vector describing the normal of the collision.


In 3D, you (except for incredible coincidences) have only two cases: a corner of one box hits a face of the other or the edges of two boxes hit. The first is pretty simple: some linear equations will give the time of impact and since you know the orientation of the struck box you know the normal. The second also will yield a time of impact to linear equations, but defining the change to the motion of each box is harder. I would transform to a frame where the point of impact is stationary, then make the recoil a given fraction of the velocity of impact, then transform back to your usual coordinates. Some one-time algebra will save the recurrent transformations, but if it is fast enough for your purposes I would suggest transforming.

  • $\begingroup$ Um ok? I should have mentioned that time is irrelevant to my simulation. What happens is I detect when two boxes intersect. Then using the normal of the collision, the point of intersection, and the amount of overlap, I calculate the of force needed to separate the objects. I'm not really sure how what you have written will help me find the point of collision. I'ved tried a point in box and edge edge tests but they never work quite right. $\endgroup$ – user8272 Mar 15 '11 at 18:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy