First off, animation plays big part in making a game feel fluid and “juicy.” Even a blocky game like this can look solid as long as the animations feel smooth. But I’ve seen too many cases where animators simply transition between discrete animations (such as walking/running or moving/strafing) using a hard cutoff. And that just looks janky and cheap.
So today I want to go into detail as to how to make character movement animation that’ll just work for ANY speed OR direction, and this is what goes into Broke Protocol’s animation system.
So if you want to have some idle animations like crossing arms or looking around, then you make this a separate state that’s only runs under a threshold velocity (called ‘StandIdle’ below). Above this velocity, you transition into the actual blended movement State. This is called ‘Stand’ below… I know! Confusing naming but I have a similar setup for crouched movement. The state transition from idle to moving is shown here.
Adding Animation Blend Trees
Now the actual movement state wont be a single animation, but a Blend Tree instead. You can add one following the steps below.
- Right-click on empty space on the Animator Controller Window.
- Select Create State > From New Blend Tree from the context menu that appears.
- Double-click on the Blend Tree to enter the Blend Tree Graph.
Now you need 5 animations imported into Unity. One for each cardinal direction (forward, back, left, right) and one centered for the idle state. In order for these animations to be blended smoothly, you need to make sure that they are all the same length AND that the movement animations always follow the same cycle pattern. For example, set a rule like all movement animations must lead with the right foot. So moving forward the animation should start with the right foot forward. Moving back the right foot should be rearward. And left strafing the right foot should start in the leftward position, etc.
Strafe velocity should be the X parameter and forward velocity should be the Y parameter. Plug in your animations and the parameters just like the following picture.
And that’s it! You should be able to set your character velocities in the code (as a fraction of their maximum velocity) and have your animations follow smoothly along.
Please bookmark our page or check us out on Facebook for continued updates every day!