Game Development Reference
In-Depth Information
F IGURE 13.17
Sequence of contacts over two frames.
of the coherence between contacts, we store the type of contact (in our case only
point-edge and edge-edge) and which particular feature was involved for each object.
Figure 13.17 shows this in action. We have a point-face contact, and in the next frame
we have the same contact (i.e., a contact between the same point and face) but with
different contact properties.
If the deepest-penetration algorithm returns a contact that we already have, then
we update the data for that contact. Otherwise the new contact is added to the con-
tacts we already have cached for those two objects, and the complete set is sent to the
collision resolver algorithm.
For each contact in our cache we need to update the values that change (i.e., the
contact normal and the interpenetration depth). If we find that the interpenetration
depth is larger than some fixed value, then the contact has moved apart by some
distance, and thus it makes no sense to consider it further. So we remove contacts
from the cache if, when updated, they have moved too far apart.
How far is too far? If we strictly use a value of zero, then we are doing too much
work. When a contact is resolved, its interpenetration is brought back to zero or less;
and we don't want the contact resolution to cause us to remove contacts from the
cache because we'd be back to the one-contact-per-frame case. As we'll see when we
look at contact resolution, it can be helpful to consider contacts that aren't inter-
penetrating when trying to resolve a whole set of contacts on one object.
So we use a small negative value. Getting the right value is, unfortunately, a matter
of tweaking.
Search Nedrilad ::




Custom Search