I’ve been making indie games for a few years now. Every project but one has been built using Unity3D. A great engine for sure, but I found it lacking in the area of animation technology. Fortunately that changed with the recent release of a new animation system called Mecanim.
Mecanim reminds me of EA’s proprietary animation engine, the single best animation engine I’ve ever used. So the thought that Unity3D was going in the same direction got me excited.
My last few years at Pandemic Studios was spent working on two Mercenaries projects simultaneously. I also had two jobs. I was the Lead Animator on one project and Lead Technical Animator on both. Lots of busy days as you can imagine.
One of my responsibilities was to evaluate new technology. At one point in the early days of pre-production I needed to find a new animation engine for the projects and ultimately the studio. I spent weeks running every engine available to me through rigorous testing. Why am I telling you all this? Because when I got my hands on a copy of Mecanim I hammered on it as if I was evaluating it for a AAA $50 million console game.
I have a lot of requirements for an animation engine. Chief among them is usability. I want the bulk of animation implementation to be handled by my animators and I want that experience to be enjoyable. This is why I always test the user experience early on. I don’t care how amazing a piece of tech is. If it’s terrible to use then it’s likely not worth using.
To test Mecanim’s usability I chose to recreate one of the many game play prototypes I did for Mercenaries 3. I needed something that covered a wide range of common animation challenges. Things like locomotion, combat, state changes and tandem characters. So I chose one of my favorites — an exo-suit. Sort of a weaponized version of the power loader from Aliens.
The original prototype took me two work days from start to finish using Mercenaries 2 art assets and tech. My time frame for the recreation was the same, two days, but I had only one asset (the player character) and no tech beyond Unity 3D.
So the first day was spent getting assets created, rigged and animated. Everything was done in Maya using my animation and rigging tools. This meant I had one day left to get something playable running in Unity.
The first task was to build animation networks for each character. They needed to idle, walk, run and switch to another state. Setting up the networks took less than an hour because so much of the workflow was similar to the EA animation engine I used at Pandemic.
Locomotion was handled with a 1D blend between the walk and run cycles. All the other nodes were single animations.
The second state was called ‘Aim’ where the exo-suit turned into an emplaced gun. No locomotion was allowed while in this state and it had transitions in and out.
A Xbox 360 controller was used for input. Unfortunately there isn’t an easy way to hook up animation network parameters (the variables that control transitions in the anim network) to controller inputs. So I had to code all that up myself. In the future I would love to see Unity implement a WYSIWYG interface for hooking up parameters to controllers (gamepad, keyboard, mouse, etc).
Putting it all Together
The final step was to put the player character inside the exo-suit. This meant syncing multiple animation networks and constraining one character to another. Both of these were surprisingly easy. For the constraint I wrote a simple component to stick the player to the suit’s root joint. Unfortunately the player could never leave the suit like in the original prototype, but back then I had a fully functional vehicle system to leverage. As for syncing networks I used the same network parameters for both characters. I just needed to make sure I was sending the signals to both networks.
The end result can be seen in the video below. I think I went over my deadline by roughly an hour due to noodling with a 3rd person camera that never worked right. All said and done I was very pleased with Mecanim and how quickly I could get up and running.