Game Development Reference
the global system of constraints, it is sufficient to make motion seem natural. The
nice thing about this scheme is that inaccuracies do not accumulate or persist visu-
ally in the system causing object drift or the like—in some sense, the combination
of projection and the Verlet scheme manages to distribute complex calculations
over several frames. Fortunately, the inaccuracies are smallest or even nonexistent
when there is little motion and greatest when there is heavy motion—this is nice
since fast or complex motion somewhat masks small inaccuracies for the human
A kind of soft body can also be implemented by using “soft” constraints, i.e.,
constraints that are allowed to have only a certain percentage of the deviation “re-
paired” each frame (i.e., if the rest length of a stick between two particles is 100
but the actual distance is 60, the relaxation code could first set the distance to
80 instead of 100, next frame to 90, then 95, 97.5, etc.). Varying this relaxation
coefficient may in fact be necessary in certain situations to enable convergence.
Similarly, over-relaxation (using a coefficient larger than one) may also success-
fully speed up convergence, but take care not to overdo this, especially if the
number of iterations is low, as it may cause instabilities.
Singularities (divisions by zero usually brought about by coinciding particles)
can be handled by slightly dislocating particles at random.
Extending the Verlet Approach
There are several ways to extend the Verlet approach to allow for more advanced
representations and features. For one thing, it is possible to represent rigid bodies
by quaternions and use inertial tensors to better model the properties of objects.
The main idea of the Verlet integration of using the previous positions instead of
velocities carries over, only the equations get a bit more complex.
Constraints that are more general than the stick constraint may be imple-
mented by computing appropriate constraint Jacobians, finding Lagrange mul-
Instead of using relaxation to solve for constraints, it is possible to use more-
precise algorithms for solving systems of equations, such as conjugate gradient
methods or Newton methods, but this is outside the scope of this chapter.
This pearl has described how a physics system was implemented in Hitman: Co-
dename 47 running on a low-spec platform. The underlying philosophy of com-
bining iterative methods with a stable integrator proved to be successful and is