Game Development Reference
In-Depth Information
In the relaxation loop, just like earlier, after adjusting the particle positions
such that nonpenetration constraints are satisfied, the six distance constraints that
make up the rigid body should be taken care of (since they may have been inval-
idated by the process), and the whole procedure is then iterated. Three to four
relaxation iterations are usually enough. The bodies will not behave as if they
were completely rigid since the relaxation iterations are stopped prematurely, but
this is mostly a nice feature, actually, as there is no such thing as perfectly rigid
bodies—especially not human bodies. It also makes the system more stable.
By rearranging the positions and masses of the particles that make up the
tetrahedron, the physical properties can be changed accordingly (mathematically,
the inertia tensor changes as the positions and masses of the particles are altered).
11.5 Articulated Bodies
It is possible to connect multiple rigid bodies by hinges, pin joints, and so on.
Simply let two rigid bodies share a particle, and they will be connected by a pin
joint. Share two particles, and they are connected by a hinge (see Figure 11.6 ).
It is also possible to connect two rigid bodies by a stick constraint or any
other kind of constraint—in order to do so, one simply adds the corresponding
constraint-handling code to the relaxation loop.
This approach makes it possible to construct a complete model of an articu-
lated human body. For additional realism, various angular constraints will have
to be implemented as well. There are different ways to accomplish this. A sim-
ple way is to use stick constraints that are enforced only if the distance between
two particles falls below some threshold (mathematically, we have a unilateral
[inequality] distance constraint,
> 100). As a direct result, the two
particles will never come too close to each other (see Figure 11.7 ) .
Particles can also be restricted to move, for example, in certain planes only.
Once again, particles with positions not satisfying the above-mentioned constraints
should be moved—deciding exactly how is slightly more complicated than with
the stick constraints.
||
x 2
x 1 ||
Figure 11.6. Pin joint and hinge joint using particles and sticks.