Game Development Reference
In-Depth Information
12. Click on the
Zombie Running
animation, which is a child asset of the
Zom-
bie
model, and duplicate it such that a new copy appears in the
Project
win-
dow. Rename this copy
Run
.
13. Click on this animation and make sure to check the
Loop Pose
checkbox so
that the animation runs in cycles.
14. Drag-and-drop the
Run
animation into the
Animator
tab. You should now
have two animations in your FSM, with the default animation still as
Idle
; if
you run the game,
Justin
should still just be idle. To make him switch anim-
ations, we need to do the following:
1. Add some transitions to the
Run
animation from the
Idle
animation
and vice versa.
2. Trigger the transitions from a script.
15. You will want to switch from the
Idle
to the
Run
animation when the player's
speed (as determined from the script) is greater than a small number (let's
say 0.1 f). Since the variable for speed only lives in the script, we will need a
way for the script to communicate with the animation, and we will do this with
parameters.