Organizing States into Sub-state Machines
Whenever content in the Animator panel gets too cluttered, you can always consider 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 animation clips provided do not includeRoot Motion, we will use the opportunity to illustrate how to overcome the lack ofRoot Motionvia a 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. We have also provided the FBX animation clips Swat@turn_right_45_degrees.fbx
and Swat@turn_left.fbx.
These files can be found in the 09_04
folder.
How to do it...
To organize States into Sub-State Machines, please follow these steps:
- Create a new 3D project and import the Mixing Unity Package, as well as the FBX files
Swat@turn_right_45_degrees.fbx
andSwat...