Game Development Reference
In other words, seen isolated, each limb is not a rigid body with the usual six
degrees of freedom. This means that the physics of rotation around the length axis
of a limb is not simulated. Instead, the skeletal animation system used to set up
the polygonal mesh of the character is forced to orient the leg, for instance, such
that the knee appears to bend naturally. Since rotation of legs and arms around
the length axis does not comprise the essential motion of a falling human body,
this works out okay and actually optimizes speed by a great deal.
Angular constraints are implemented to enforce limitations of the human
anatomy. Simple self-collision is taken care of by strategically introducing in-
equality distance constraints as discussed above, for example, between the two
knees—making sure that the legs never cross.
For collision with the environment, which consists of triangles, each stick is
modeled as a capped cylinder. Somewhere in the collision system, a subroutine
handles collisions between capped cylinders and triangles. When a collision is
found, the penetration depth and points are extracted, and the collision is then
handled for the offending stick in question exactly as described earlier. Naturally,
a lot of additional tweaking was necessary to get the result just right.
11.6.1 Motion Control
To influence the motion of a simulated object, we simply move the particles cor-
respondingly. If a person is hit in the shoulder, move the shoulder particle back-
wards over a distance proportional to the strength of the blow. The Verlet integra-
tor will then automatically set the shoulder in motion.
This also makes it easy for the simulation to “inherit” velocities from an un-
derlying traditional animation system. Simply record the positions of the particles
for two frames and then give them to the Verlet integrator, which then automati-
cally continues the motion. Bombs can be implemented by pushing each particle
in the system away from the explosion over a distance inversely proportional to
the squared distance between the particle and the bomb center.
It is possible to constrain a specific limb, say the hand, to a fixed position in
space. In this way, we can implement inverse kinematics (IK): inside the relax-
ation loop, keep setting the position of a specific particle (or several particles) to
the position(s) wanted. Giving the particle infinite mass (invmass=0) helps make
it immovable to the physics system. In Hitman ,thisstrategyisusedwhendrag-
ging corpses; the hand (or neck or foot) of the corpse is constrained to follow the
hand of the player.