Game Development Reference
In-Depth Information
Under Mirror you can see the average velocity from the Root Motion. Fractional velocities along axes
other than the one you are interested in are an indicator of possible drifting. You can choose whether
this animation clip should continue from the character's previous movement vector Based Upon
either the model's body orientation or the original forward movement vector it has at the time this
clip is played.
Offset allows you to further fine-tune the transform to account for any discrepancies that might be
introduced by the animation clip.
Root Transform Position (Y) works similarly to Rotation. In this case, you would want to check Bake
Into Pose for a walking animation to prevent upward or downward drift, but you would leave it
unchecked for a Jump animation to allow up and down movement while jumping.
Root Transform Position (XZ) addresses movement along the xz plane, which is the same as the
“floor.” Recall that in Unity, the y axis represents up and down in the game world. By leaving Bake
Into Pose unchecked, the character will move in the scene on the xz plane while performing the
animation. Idle is an example of a common animation clip where you would want to check Bake Into
Pose to prevent inadvertent movement.
The green circles are an indicator of how smoothly the animation will loop, based on how similar the
transform properties of the model are in the first and last frames of the clip. The warning indicators
change to yellow, then red as the transitions from the end of one loop to the beginning of the next
diverge. The indicator for Root Transform Position (XZ) is red, as the zombie will move a step forward
to a new position with each animation loop.
Now your animation is ready to test, but it's easier to see the walking Root Motion with some
background for perspective rather than a flat color. Create a plane for your scene and set its
transform to (0, 0, 0) and its scale to (30, 1, 30). In the top menu select Assets ➤ Import Package ➤
Terrain Assets and click Import. Find the Terrain Textures folder in this package and drag the
Grass&Rock texture to the Plane in the Hierarchy view. The texture should appear on the plane in the
Scene view. In the plane's Mesh Renderer component, set the x and y Tiling values to 5.
Find the zombieController01 in the Animators folder in the Project panel. Double-click it to open in
the Animator window. Select the Zombie Run state. Rename it Walk in the Inspector, then drag the
walkWithMotion animation clip from the Animations folder in the Project panel to the Motion field
in the Inspector. Note that you do not want the entire zombie_lowres@walkWithMotion file, just the
animation clip. Click the arrow on the zombie_lowres@walkWithMotion icon to expand it and locate
the animation clip (Figure 5-33 ).
Figure 5-33. Animation clip icon within zombie_lowres@walkWithMotion
Play, and you'll see the zombie perform the walking animation while moving forward in the game
world across the plane. Cool!
 
Search WWH ::




Custom Search