Game Development Reference
In-Depth Information
F IGURE 14.12
Repeating the same pair of resolutions.
the first to penetrate again, and so on. Given enough iterations, this situation will be
resolved so neither corner is penetrating. It is more likely that the iteration limit will
be reached, however. If you check the number of iterations actually used, you will find
this kind of situation is common and will consume all available iterations.
The same issue can also mean that a contact with a small penetration never gets
resolved: the resolution algorithm runs out of iterations before considering the con-
tact. To avoid this situation, and to guarantee that all contacts get considered, we can
run a single pass through all the contacts and then move on to the best-first iterative
algorithm. In practice, however, this is rarely necessary, and a best-first resolution
system works well on its own. Problems may arise, though, for fast-moving, tightly
packed objects; for simulations with longer time steps; or when there are very small
limits on the number of iterations.
Typically objects that gradually sink into surfaces and then suddenly jump out a
short way are symptomatic of penetration resolution not getting to shallow contacts
(i.e., the contacts are ignored until they get too deep, whereupon they are suddenly
resolved). If this happens, you can add a pass through all contacts before the iterative
algorithm.
Iterative Algorithm Implemented
To find the contact with the greatest penetration we can simply look through each
contact in the list. The contact found can then be resolved:
Search Nedrilad ::




Custom Search