Game Development Reference
stop. This is a typical frustrating artifact in certain car racing games where the
car can get trapped on invisible hooks while sliding along the fence. A simple
workaround is to construct the geometry as suggested in Figure 2.6.
Near phase. The near phase is by far the most complex part, where the actual
contact generation occurs. The poor solver is often blamed for unstable and jit-
tering simulations, but surprisingly often, shaking objects, general instability, and
jerkiness can be attributed to inadequate contact generation. A sequential-impulse
solver can be blamed for squishy stacks, improper friction, and many other things,
but it is actually quite hard to make a solver that causes objects to rattle and shake.
Near-phase contact generation often has many special cases and can be prone to
numerical floating-point precision issues. Some engines use contact pruning to
remove excess contact points. Special care should then be taken to make sure the
same contacts are pruned every frame. Remember that keeping the configuration
unchanged is key to stability.
2.6.2 Continuous Collision Detection
Ah, continuous collision detection, a technique that prevents objects from slipping
through walls—how about that! Just enable it, sit back, and enjoy how everything
magically works? Not quite, unfortunately.
Let us start by splitting the problem domain into two categories. First, there
are artifacts caused by discretization, typically, a small object passing through a
wall, called the bullet-through-paper problem already mentioned in the beginning
of this chapter. The other category is when contact is detected and generated,
but the solver fails to find a proper solution, usually because of early termination.
This artifact can be very significant when a light object is getting squished in
between two heavy objects and is sometimes referred to as the sandwich case (see
Figure 2.7. Fast-moving objects are not the only ones taking shortcuts through walls.
Early solver termination can cause objects to get squished even if contacts are detected and