Game Development Reference
In-Depth Information
the physics core by code manipulation and trading off memory against speed. I'll say
a few things briefly about that at the end of the section.
There remains a significant performance problem with the way contacts and col-
lisions are detected and handled, however.
In chapter 14 I mentioned that performance could be improved by batching together
groups of contacts. For our engine this provides a useful speed-up. For engines that
do simultaneous resolution the speed-up can be critical.
Figure 16.5 shows a simple scene. There are several contacts in the scene, gener-
ated by the collision detector. In the collision resolution system, contacts A, B, and
C can all affect one another: resolving contact A can cause problems with contact B,
and resolving B can affect both A and C. Contacts D and E are likewise related. But
notice that A, B, and C cannot affect D, E, or F; D and E cannot affect A, B, C, or F;
and F cannot affect any of the others.
In fact two contacts can only affect each other if they are connected through a
series of rigid bodies and other contacts. So contact A and C can affect each other
because they are connected through bodies 2 and 3 and contact B.
Our resolution algorithm checks all possible contacts to see whether they have
been affected by a previous resolution. It also checks through all contacts to find the
current, most severe contact to resolve. Both these operations take longer for longer
lists of contacts.
F IGURE 16.5
Sets of independent contacts.
Search Nedrilad ::

Custom Search