Organizing States into Sub-state Machines
Whenever the Animator area gets too cluttered, you can always think of organizing your Animation States into Sub-State Machines. In this recipe, we will use this technique to organize animation states for turning the character. Also, since the provided animation clips do not include Root Motion, we will use the opportunity to illustrate how to overcome the lack of Root Motion via script, using it to turn the character 45 degrees to the left and right.
Getting ready
For this recipe, we have prepared a Unity Package named Turning
, containing a basic scene that features an animated character. The package can be found inside the 1362_07_04
folder, along with animation clips called Swat@turn_right_45_degrees.fbx
and Swat@turn_left.fbx
.
How to do it...
To apply Root Motion via script, please follow these steps:
Create a new project and import the
Turning
Unity Package. Then, from the Project view, open the mecanimPlayground level.Import the
Swat@turn_right_45_degrees...