Game Engine Architecture

(Ben Green) #1

680 12. Collision and Rigid Body Dynamics


z having the character slide along walls when he runs into them at an
oblique angle;
z allowing the character to “pop up” over low curbs rather than gett ing
stuck;
z preventing the character from entering a “falling” state when he walks
off a low curb;
z preventing the character from walking up slopes that are too steep
(most games have a cut-off angle aft er which the character will slide
back rather than being able to walk up the slope);
z adjusting animations to accommodate collisions.
As an example of this last point, if the character is running directly into a
wall at a roughly 90 degree angle, we can let the character “moonwalk” into
the wall forever, or we can slow down his animation. We can also do some-
thing even more slick, like playing an animation in which the character sticks
out his hand and touches the wall and then idles sensibly until the movement
direction changes.
Havok provides a character controller system that handles many of these
things. In Havok’s system, illustrated in Figure 12.37, a character is modeled
as a capsule phantom that is moved each frame to fi nd a potential new loca-
tion. A collision contact manifold (i.e., a collection of contact planes, cleaned
up to eliminate noise) is maintained for the character. This manifold can be

Figure 12.37. Havok’s character controller models a character as a capsule-shaped phantom.
The phantom maintains a noise-reduced collision manifold (a collection of contact planes)
that can be used by the game to make movement decisions.
Free download pdf