582 11. Animation Systems
In a fl at weighted average architecture, we have a fl at list of all the ani-
mation clips that could possibly be played on the character. Each clip state
has a blend weight, a playback rate, and possibly other control parameters.
The code that controls the character must look up individual clip states by
name and adjust each one’s blend weight appropriately. This makes for a sim-
ple interface, but it shift s most of the responsibility for controlling the blend
weights to the character control system. For example, to adjust the direction
in which a character is running, the character control code must know that the
“run” action is comprised of a group of animation clips, named something
like “StrafeLeft ,” “RunForward,” “StrafeRight,” and “RunBackward.” It must
look up these clip states by name and manually control all four blend weights
in order to achieve a particular angled run animation. Needless to say, control-
ling animation parameters in such a fi ne-grained way can be tedious and can
lead to diffi cult-to-understand source code.
In a blend tree , a diff erent set of problems arise. Thanks to the tree struc-
ture, the clips are grouped naturally into functional units. Custom tree nodes
can encapsulate complex character motions. These are both helpful advantag-
es over the fl at weighted average approach. However, the control parameters
are buried within the tree. Code that wishes to control the horizontal look-at
direction of the head and eyes needs a priori knowledge of the structure of
the blend tree so that it can fi nd the appropriate nodes in the tree in order to
control their parameters.
Diff erent animation engines solve these problems in diff erent ways. Here
are some examples:
- Node search. Some engines provide a way for higher-level code to fi nd
blend nodes in the tree. For example, relevant nodes in the tree can be
given special names, such as “HorizAim” for the node that controls hor-
izontal weapon aiming. The control code can simply search the tree for
a node of a particular name; if one is found, then we know what eff ect
adjusting its blend weight will have. - Named variables. Some engines allow names to be assigned to the indi-
vidual control parameters. The controlling code can look up a control
parameter by name in order to adjust its value. - Control structure. In other engines, a simple data structure, such as an
array of fl oating-point values or a C struct, contains all of the control
parameters for the entire character. The nodes in the blend tree(s) are
connected to particular control parameters, either by being hard-coded
to use certain struct members or by looking up the parameters by
name or index.