Manifold for boxes
Finding the collision manifold between two OBBs is difficult. The collision normal and penetration distance come right from the Separating Axis Theorem. Recall that there are potentially 15 axes of potential separation between two OBBs. While performing the SAT tests, we keep track of which axis had the least penetration; that is the axis of intersection. The collision normal is the same as the axis of intersection. The penetration depth is the difference between the centers of both the OBBs projected onto this axis.
What makes finding the manifold for OBBs difficult is determining the contact points between the boxes. There are several ways in which two boxes could intersect, each producing different types of contact points:
We will implement a less than optimal and simple solution. Given two OBBs, A and B, we will find the intersection points of the edges of A and the planes of B as well as the edges of B and planes of A. This essentially clips each box against the other...