Game Development Reference
F IGURE 13.7
The edge-face contact data.
E DGE -F ACE C ONTACTS
Edge-face contacts are only used with curved surfaces (the edge of a capsule, for ex-
ample, or the surface of a sphere). The contact data is generated in a very similar way
to point-face contacts, shown in figure 13.7.
The contact normal is given by the normal of the face, as before. The edge direc-
tion is ignored in this calculation.
The contact point is more difficult to calculate for the general case. In the more
general case we need to calculate the point of deepest penetration geometrically. For
some primitives there is a quick way to get this.
Because of the way the contact point is calculated, we normally have direct access
to the penetration depth. If not, then it needs to be calculated the long way, by work-
ing out the distance between the edge and the face along the direction of the normal
passing through the contact point.
F ACE -F ACE C ONTACTS
Face-face contacts occur when a curved surface comes in contact with another face,
either curved or flat, such as a sphere on a plane. The contact data is somewhat more
arbitrary than for other cases. Figure 13.8 shows the properties in detail.
The contact normal is given by the normal of the first face. In theory the faces
should have opposite contact normals: two faces can't touch except where their nor-
mals are in the opposite directions. In practice, however, this isn't perfect, and the fact