Building a weapon animation state machine
Now that we've built an entire animation state machine system, it's time to build the ASMs our soldier will use. As the soldier's weapon is the simplest ASM, we'll start there first. With only five different animations, this is a relatively easy ASM to build.
First, we add each of the states with their corresponding animations and specify whether the animation is looping or non-looping. Next, we connect each state via transitions. Lastly, we request a state within the ASM to start playing a looping animation; in this case, this is the sniper_idle
state.
Note
The reload animation for the weapon only works when the weapon is in its sniper pose. The ASM must reflect this; otherwise, you will see a noticeable pop on the sniper pose before the reload animation plays.
Creating the weapon ASM primarily consists of adding each state, the states corresponding to the animation to play, and creating transitions between...