Point of intersection between Oriented Boxes (or OBB)

1.8k views Asked by At

I am trying to write a Rigid body simulator, and during simulation, I am not only interested in finding whether two objects collide or not, but also the point as well as normal of collision. I have found lots of resources which actually says whether two OBB are colliding or not using separating axis theorem. Also I am interested in 3D representation of OBB. Now, if I know the axis with minimum overlap region for two colliding OBB, is there any way to find the point of collision and normal of collision? Also, there are two major cases of collision, first, point-face and second edge-edge. I tried to google this problem, but almost every solution is only detecting collision with true or false.

Kindly somebody help!

1

There are 1 answers

0
AudioBubble On

Look at the scene in the direction of the motion (in other terms, apply a change of coordinates such that this direction becomes vertical, and drop the altitude). You get a 2D figure.

Considering the faces of the two boxes that face each other, you will see two hexagons each split in three parallelograms.

enter image description here

Then

  • Detect the intersections between the edges in 2D. From the section ratios along the edges, you can determine the actual z distances.

  • For all vertices, determine the face they fall on in the other box; and from the 3D equations, the piercing point of the viewing line into the face plane, hence the distance. (Repeat this for the vertices of A and B.)

Comparing the distances will tell you which collision happens first and give you the coordinates of the first meeting point (in the transformed system, the back to absolute coordinates).

The point-in-face problem is easy to implement as the facesare convex polygons.