Game Development Reference
In-Depth Information
F IGURE 13.8
The face-face contact data.
that objects may interpenetrate means that the actual normals may be misaligned. It
is easier to use just one contact normal consistently as long as the two objects won't
swap roles in future contact generations (i.e., in the next frame we should avoid hav-
ing a contact generation where objects A and B are swapped). It is unusual to find
such swapping, so it is safely ignored.
The contact point is again difficult to calculate in the general case. And once again,
using the primitives in this chapter, we can often get directly at the point of greatest
penetration. If not, then we need to select some point (pretty arbitrarily in the code
I've seen that does this) from the inside of the interpenetrating volume.
The contact point calculation will normally give us direct access to the penetration
depth. In the general case we'll have to follow the full algorithm, as we saw in the last
section.
13.2.6
E ARLY -O UTS
Some of the contact generation algorithms can be quite time consuming. The coarse
collision detection will generate candidate pairs of objects that may later be found
not to be in contact. We can make collision detection much more efficient by creating
algorithms that exit early if no contact is found.
There are numerous opportunities to do this as part of the contact generation
algorithms we will look at later and the code takes advantage of as many of these as
possible.
Search Nedrilad ::




Custom Search