top of page

Mecanim Blend Trees


While working on our final game, Shift I was able to simplify our Animator into a few basic states. One of the common problems with Mecanim is how easily convoluted it can get. The more complex our characters become the more animations we needed to keep track of. It easily ends up with a long list parameters that need to constantly be toggled.

Originally when planning out our art pipeline, I was only planning for our basic states : Idle, Walk, and Attack. However as our game grew so did the number of animations our character needed. With the way it was currently set up we would have to create a transition from every single state to another and a parameter to toggle it. If we had continue to use the setup we had, it would become an even bigger mess when we needed to add more animations.

At the end of our game we had a total to 11 animation clips. Instead of creating a state for each one I was able to simplify it to 5 states. Previously, I had looked into blend tree for 3D animations, where it was used to blend character models with rigs seamlessly into one another. Our characters in Shift didn't have any rigs for this to be useful, however we were able to use the blend tree to simplify our state machine. Instead of 6 separate states for : Idle, Walk, Strafe Left, Strafe Right, Bow Attack, and Sword attack. I created basic blend tree states. And got it down to just a movement and an attack state. Now we would only have to toggle between movement and attack. Since we were using GetAxis, we used two parameters that kept track of our horizontal and vertical movement. If the x and y parameter were 0 the player would stay in the idle state, however if our vertical input was 1, it would set the y parameter to 1 and play our walking animation.

I setup our attack state the same way, but instead of keeping track of our inputs, we had a weapon index parameter. 0 would be our standard sword attack while 1 would be our bow attack. If we had decided to create more items and a unique animation for them, all we would have to do was add to our attack blend tree and set a weapon index, without touching our attack or movement parameters or toggling through all of our animations.


bottom of page