Unity 4 - More Mecanim!

Unity 4 - More Mecanim!

By Robert Lanciault

June 25th 2012 at 3:07PM

Keen to learn more about what Mechanim brings to Unity 4? The animation tech's lead developer explains all

My name is Robert Lanciault. I am lead developer for Mecanim at Unity. I wrote this post to provide more information about what you can do with the new Mecanim character animation system in Unity 4, and how. We are thrilled that so many of you guys and gals are psyched about getting your hands on Mecanim.

Sonny Myette, Pierre-Paul Giroux and I started to develop Mecanim Animation Middleware almost 3 years ago now. When Unity approached us last year, we quickly realised that it was a unique chance for our technology to be natively integrated in a game engine and that with Unity we could develop the best animation tool ever. We joined this fantastic team 6 moths ago and we are now thrilled to release this first version of Mecanim in Unity 4.0.

A lot of you are hungry for more specific technical information. This is understandable, and we will provide extensive documentation for Mecanim when Unity 4.0 is officially released soon. In the meantime, I hope you find this additional information helpful.

Mecanim is a complete turnkey solution for character animation in games. It abolishes the need to spend expensive development efforts to integrate 3rd party middleware. Mecanim is natively integrated with and optimised to run in the Unity Engine. From the Editor, you get all the tools and workflows needed to create and build animation assets directly into your game.

Retargeting your animations

The retargeting aspect of Mecanim lets you choose among a vast library of existing motions or prebuilt controllers to immediately start animating your favorite characters without extensive planning on mo-cap sessions. Kickstart or realise your entire project with animation assets found on the Unity Asset Store or bring in your mo-cap or keyframe animation files to the Editor, and convert them to your own retargetable animation asset.

The retargeting rig can be set up on your humanoid character with just a few mouse clicks using automatic bone mapping and stance pose computing algorithms. The retargeting rig breaks down human body motion into a set of muscle contractions and uses a mass model to compute body mass centre and average body orientation for motion trajectory. The retargeting rig can be used to extract muscle space animation out of your standard animation files or, as in most cases, apply animation assets to your animated character.

Blend trees and state machines

The Unity Editor provides powerful tools to split, create loops and extract trajectory from imported animation files. Those animation clips can then be used as leaves in a multilevel Blend Tree or as a State in a Hierarchical State Machine. Blend Trees let you create a wide variety of motion using only a few motion clips. In the Blend Tree Editor, you define blending parameters and preview the blended animations in a 3D view. Blend Trees, like Animation Clips, can be used as states in a hierarchical State Machine.

The Animator Tool is where the Multilayer Hierarchical State Machines are created. A controller can define an arbitrary number of Layers. Each Layer can use its own State machine or share a State Machine with a master Layer. Layers can be overridden or additive and the use of a Body Mask defines which part of the humanoid body they will affect. Finally, you can use a Hierarchy of State Machines to break down a complex and huge controller into smaller reusable modules.
The transition previewer, combined with a Multilayer Hierarchical State Machine, lets you easily author and tweak transition timings to perfection. The Live Link visual feedback provides an immediate overview of your states and transitions, and lets you debug the most complex controllers needed for your game.

IK rigs

You can then apply the final touch to your animation using the automatically created IK rigs to adjust feet on the ground, hands on the edge of a wall or look at something using eyes, head and full body adjustments. Other features, such as feet stabilisation, auto compute of blending pivot and trajectory matching will help you create incredibly life-like interactive animation.

So, are you wondering about how many characters you’ll be able to drive using this powerful feature set? Well, we reached the magic number of 1,000 characters running at 30fps on a standard laptop.

And be sure to check out this cool video over at Unity's website.

---

Thank you to Unity for providing this blog for publication. Many more Unity blogs are available here on the Unity website.