Game Development Reference
In-Depth Information
From the animate node's perspective, it doesn't matter whether the animator is
Mecanim or not, so we only need to make a few simple changes. Change the waypo-
int patrol node's waypoint route to
"TeddyRoute"
. Then, in the
animate run
node,
set
Animation State
to
Base Layer.Run
and set animation idle's
Animation State
field to
Base Layer.Idle
. And one important change for Mecanim is to set the anim-
ate node's
Repeat
field to
Forever
. The following screenshot shows the new beha-
vior tree:
If you run the demo now, you'll see Teddy running along the path and then be in the
idle state at the end, just like Penelope. But there is one problem: Teddy is running
way too fast. The reason is that RAIN is moving the model and the animation sys-
tem is also applying movement to the character, making Teddy move fast artificially.
To fix this, go back to the
Animator
component of
Teddy
and uncheck
Apply Root
Motion
. This will keep the animation system from applying movement and Teddy will
now run at a better rate. Running the demo now, Teddy will run and idle at the end.
Additional Mecanim nodes
BesidesusingtheanimatenodeforMecanim,RAINhasadditionalnodesspecifically
for Mecanim, mostly useful in special cases. The nodes are as follows:
•
Mecanim IK
: This node is used to modify the inverse kinematics on part of a
model
•
Mecanim State
: This node is used to check the animation controller state
•
Mecanim Parameter
: This node is used to change a Mecanim parameter
These are less-used nodes but are good to know.