Wednesday, 25 June 2014

Mecanim Animations

I have been working on moving about the game and getting the animations in place for the actions I will need.

The advantage of Unity is there are lots of pre-produced kits to use.  Some free but most have a small amount to pay.  I have been working on the in-game movement.  I have tried lots of the free packages, used most of the tutorials and purchased a lot of animations at modest prices.

I have found that the Unity Mecanim system is very powerful.  It has some great advantages, like being able to re-task animations from one model to another.  Like any complex system, getting the best out of Mecanim is still time consuming.

None of the assets I tried or purchased had a control system or set of animations that completely suited how I wanted Diabolical to behave.  I have therefore created the input controller and the Mecanim controller almost from scratch.

I created myself a test environment using bits and pieces from the assets I purchased and some of the tutorials.  This made it easy to test changes.

Some of the best animations I purchased were designed for root motion as are most of the latest Unity tech demos.  Root motion is where the animation moves the character within the world.  This leads to a much better looking result.  The trouble I found was that I could not get it to feel like a first person game.  It felt like watching a third person.  For example, instead of the animation moving as quickly as the player input round a corner, there was a nice looking smooth curve but not quite what the player controls were doing.

Diabolical is an over the shoulder game, so although the view is third person the controls should feel like a first person game.


If I had more time or lots of people to work on it, I am sure root motion can be used to produce a good feeling and good looking first person solution, unfortunately I have neither the time nor the people, it's just me.  I have opted for the more traditional route of the input directly moving the player entity and the animations doing a best approximation of the movement to get there.

You end up with feet sliding and perhaps the odd lag in the animation but to me the movement feels better from a players perspective.

It's taken a few weeks and I've had a few frustrating days in that time but I am now happy with the result.


I have more and better animations than I had in the XNA version.  In Unity I already have rifle and pistol aiming up and down, walking, running, jumping, shooting and reloading.  I just need to add throwing grenades and I am done with this bit.