Game Development Reference
In-Depth Information
class Contact
* Holds the position of the contact in world coordinates.
Vector3 contactPoint;
* Holds the direction of the contact in world coordinates.
Vector3 contactNormal;
* Holds the depth of penetration at the contact point. If both
* bodies are specified then the contact point should be midway
* between the inter-penetrating points.
real penetration;
Before looking at the particulars of different primitive collisions, it's worth look-
ing at each contact case in turn and how its parameters are determined.
Point-face contacts are the most common and important type of contact. Whether
the face is flat or curved, the contact properties are generated in the same way. This is
illustrated in figure 13.5.
The contact normal is given by the normal of the surface at the point of contact.
If the object point (i.e., the point that is in contact with the face) is penetrated into
the surface, then it is usually projected back onto the surface in order to determine
where the contact is measured from.
The contact point is given as the point involved in the contact. In some cases a
point is used that is midway between this object point and the projected point on the
face. Either case works well, but using the given point is often more efficient.
The penetration depth is calculated as the distance between the object point and
the projected point.
Edge-edge contacts are the second most important type of contact and are critical for
resting contacts between objects with flat or concave sides. The contact data is shown
in figure 13.6.
Search Nedrilad ::

Custom Search