4

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!

dplank
  • 91
  • 8
  • 1
    Usually, OBB tests are used as a *conservative* test to quickly rule out objects that *cannot* collide. (Sometimes called "broad phase"). If the OBBs intersect, and the objects *might* collide, the "narrow phase" begins. There, you check each vertex/edge of one object for collisions with each face/edge of the other object. (This is expensive - therefore, OBBs and bounding volume hierarchies are used!). The "collision detection" then consists of computing the closest points for the V/F and E/E pairs. If the distance of these points is near zero, then the objects collide at these points. – Marco13 Jul 20 '17 at 21:12
  • The exact point of collision indeed depends on the exact trajectory. Can we assume a straight line ? And is the line aligned with one of the boxes ? –  Jul 20 '17 at 21:36

1 Answers1

0

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.