Game Development Reference
F IGURE 13.18
Projection of a point-face contact.
The algorithm works in this way:
1. Consider each vertex of object A.
2. Calculate the interpenetration of that vertex with object B.
3. The deepest such interpenetration is retained.
4. Do the same with object B's vertices against object A.
5. The deepest interpenetration overall is retained.
The point-face detection code therefore looks like this:
Excerpt from src/collide_fine.cpp
const Box &box,
const Vector3 &point,
// Transform the point into box coordinates.
Vector3 relPt = box.transform.transformInverse(point);
// Check each axis, looking for the axis on which the