Game Development Reference
metaball implementation, seen in many 3D modeling packages. This is quite a com-
plex algorithm, but for a small number of masses it's easily tractable. The metaball
algorithm isn't simple, and I won't cover it here; you can see any good textbook on
modeling for an explanation of how metaballs work.
The blob demo on the CD gives a simple implementation of a Loco Roco-style
While slightly cumbersome, a mass-aggregate physics engine is capable of simulating
some interesting and complex effects. Sets of relatively simple objects, joined by a
mixture of hard and elastic constraints, are particularly suited to this approach.
The first example we saw, rope-bridges, have been simulated with a mass-
aggregate approach for many years. The second example showed how to build large
objects out of a set of particles. While this can work successfully, it is prone to many
problems. Objects made up of lots of particles and lots of hard constraints can be
slightly unstable; they can appear to flex and bend when simulated, and in the worst
case there can be noticeable vibration in the particles as their constraints pull them in
There is a better way to simulate a single large object. Rather than build it out
of particles, we can treat it as a whole. To do this we'll need to change our physics
engine dramatically, however. As well as just simulating the position, velocity, and
acceleration of an object, we'll need to take into account how it rotates as it moves.
This will introduce a large amount of complexity into our physics engine and will
take us the rest of this topic to implement properly. Chapter 9 takes the first step,
introducing the mathematics of rotation.