Game Development Reference
In-Depth Information
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
unsigned CollisionDetector::boxAndPoint(
const Box &box,
const Vector3 &point,
CollisionData *data
// Transform the point into box coordinates.
Vector3 relPt = box.transform.transformInverse(point);
Vector3 normal;
// Check each axis, looking for the axis on which the
Search Nedrilad ::

Custom Search