Search Unity


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 realized 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 optimized 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 mocap sessions. Kickstart or realize your entire project with animation assets found on the Unity Asset Store or bring in your mocap 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 center 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 stabilization, 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. Thanks!

83 replies on “Unity 4: More Mecanim!”

So with this system we need to set up the IK parameters in our modeling program of choice, and then it will be approximated in Unity. That means we have to re-tweak it again. So approximately how accurate is the conversion process, or are we expected to just apply basic animations in our modeling software and do most of the fine work in Unity?

for example: avatar body contains hip, spine, chest as an un-seperatable set. I want to set hip, spine, and legs to lower body animations (walk, run, sprint, crouch, etc.) But reserve chest, arm, head for upper body actions.

I opened the body mask file and found:
m_Name: Upper Body Mask
m_Mask: 00000000010000000100000000000000000000000100000001000000010000000100000000000000000000000100000001000000
Modify the binary number after m_Mask should do the trick, right?
Or I can just wait for the future update.
Thanks a lot.

@AKQJ10: (1) You can use the “Any State” box in Animator tool to force a transition from any state you are in. Create a transition from the “Any State” box to a destination state (ex: Dead) and create a condition that looks for Health Point. (2) You can’t define more specific Body Mask in 4.0, but it is something we could do in future. Can you tell me about your use case for a more specific body mask?

@carl: We are currently working in adding support for generic skeleton structure in Mecanim. This means that your mouse character could be entirely treated as a generic skeleton or as a humanoid with additional bones in it. Animations on additional bones we’ll playback correctly on original skeleton, but won’t be retargeted to other skeletons. Generic skeleton feature is progressing well and should be available soon.

I am using Unity 4 Beat 6, mecAnim is just awesome!
Just 2 questions here
(1) In the Animation State Machine, is there a way to force State switch? For example, I have , , and states. In each state, I can add a transition to when Health Point drops to 0. Or can I write my own script to monitor the Health Point and force the FSM to switch to ?
(2) Can the Body Mask be more specific? I’d like to enable/disable individual bone for certain animations. The current system can only turn on/off whole block of body parts (like the whole arm). I tried to save the Body Mask file to “force text”, and edit it in notepad, not much luck in that approach.
Thanks in advance.

I am testing Mecanim. Imported a character and created an avatar. I made some animation for this character and here is where the problem starts. The character is a little mouse it has animation on the tail, nose, ears and whiskers. When I preview or use the animation the animation on the tail, nose, ears and whiskers got lost. Al animation that was mapped to the avatar is visible. How do I get all the animation that was made for this character?


Thank you for the answer and congratulations for the system, it is really amazing (started to play with the beta).
I will try to understand it first, but I think it will be possible to make what I want with a bit of scripting.



Hi James,

The IK system will still be fully usable even if you don’t use the animation root motion.

Mecanim evaluation pipe can be split in 4 main steps:

1 – State Machine / FK blending. This step computes the blended muscle pose and root motion

2 – Apply the root motion. In this step you may apply the animation root motion which is the default behavior or blend it with some procedural or totally override it with any root motion you like. There is the OnAvatarMove callback you can use to modifiy root motion just after SM/FK step and before retarget step.

3 – Retarget. The muscle pose is retageted to you Avatar skeleton. World space transform of the skeleton can now be computed.

4 – IK step. Now that world space transform is know, you can now apply IK solver to reach objects in the 3d scene.

Note that if you don’t plan to use animation root motion at all, you can set the root transform before step #1 in a Update() call and IK will still work fine.


Hi @Robert,

We are developing an animation software with a timeline that would go back and forth and the character would play/stop/rewind all this being controlled by a scroll bar. Is it possible to control the frame of the resulting character animation via script?

Thank you.


Hello Robert,

If we decide to not use the root motion to drive animations, does that still allow full usage of IK systems? Are there any features from Mecanim that fully depend on utilzing root motion?


@Michael: Most of Mecanim features will be available for free in Unity 4. Users should use Mecanim to transfer animation from one humanoid 3D character to another and benefit from all its advanced retargeting capabilities.

Is Mecanim free, a separate program from Unity 4 or a Unity Pro feature? Without Mecanim, can a developer manually transfer animations from 1 3D character to another by re-linking the leftover curves in Unity’s Animation window based on the differences between the characters’ skeletal structure?

I guess I’ll have to wait to really tinker with this to see what I can do with it but specifically will there be a system built in that might be similar to the aim node that can be found in UDK’s animtree system?
My guess is that it will more likely require pre-done animations for leaning back and forward and then just creating a blend tree similar to the run, run-right and run-left that was shown in the video, but just hoping for more information on what else we can hope to see in the mecanim system.

@Victor: We are still experimenting on this, but mainly yes. We have code that does lost less conversion from Skeleton to Muscle and then from Muscle to Skeleton. The skeleton used by the rag doll is usually lower-res than the animation skeleton, but using the Muscle “retargeting” space to blend rag doll and animation there is mostly no lost in fidelity. Again, it is experimental stuff, results are very interesting.

At the risk of sounding stupid, Do you mean the angles from the ragdoll were converted to ranges withn muscle DOFs. Like they were normalized, each muscle contraction stiffened/dampened per avatar then applied within specified muscle range? Would you not lose some fidelity from that?
Seems interesting.

@Victor: from a previous post:

“Muscle space is not available in public API… yet, but it is totally “open-able”. We did some internal tests where we converted ragdoll simulation to muscle space and blended it with animations in State Machine. It will be made available in future version. This would also enable you to drive characters from live animation.”

Or use Muscle Space to induce procedural effects like leaning.

Also in the Avatar Setup Tool, you can adjust the range for each muscle. Make them stiffer or looser. The adjusted ranges for your Avatar will show in retargeted animation.

In the muscle editor there were some sliders for rolling and leaning. Do we get control of those functions at runtime to do things like procedural leans? I remember hearing things like controlling the stiffness of the characters. Where does that come in? Retargeting?

@manutoo: You have a “humanScale” on the Animator component that let you query the relative size of your character and also “speed” that let you control playback speed. This should let you easily do it by script!

At end of video, we see the animation plus the size of the character control the speed of the character in the world.
Is it possible to do the opposite : the speed of the character in the world controls how fast the animation is played, factored by his size ? And if yes, is it easy to do (maybe by script) ?

This is good to know, because in Unity 3 at present, my models will distort if I use animations from a taller character… can’t wait for this to come out

When unreal added hik support they let users use them as animation nodes. can we expect this in unity4?

it is possible turn a model into a ragdoll. However more complex blended ragdoll support, where you can make only the arms be affected by ragdolls and the rest by animation is something we want to do at some point but will not be in the initial release.

3. Collision detection is probably best handled with the colliders & rigidbodies / raycasting or a custom solution.

@ NeptuneImaging:
The IK system will solve this perfectly. It’s great for adjusting animations to hit in exact locations.
Best of all once a character has setup retargeting, you can write a 2 liner and apply the IK with weights.

I also have some questions as well about Mecanim, with not only the retargeting, but also things like offsetting parts of an animation, triggering ragdolls during a certain event, registering player damage…

1. Will I be able to offset parts of my animation?

Example A: Let’s say throw a punch that will always aim for the head, no matter how tall the characters are. Example, player A is 5’9″ and player B is 6’5″ and they box share the same animation. The problem will arise when Player B throws a jab and it goes over Player A’s head who gets an easy hit. Will I be able to change that offset so that the jab will hit the “head” (I have hitboxes on my models) on shorter opponents?

Example B: I am sure you have seen this on older wrestling games… where Big Show goes to chokeslam a shorter opponent like Rey Mysterio… his hands either clutch the face or clip over him. Will there be way to make sure the wrist and hand always goes for the throat?

2) Will I be able to blend into a ragdoll in a fighting or shooting game like after a hit…or death (LIke in Euphoria)?

3) Could I also be able to connect this to playmaker for things like registering damage?

@TheLorax: We’ll still rely on 3D Modeling software or Mixamo auto-rig for rigging and weighting, but it is definitively something we are looking at.

@Victor: We’ll have more videos, more tutorials, more content, enough to keep you over excited!

Will the rigging and weighting process be internal to Unity as well, or is this still done in the 3D modeling program? I’d love it if it had a built in auto-rig system like Mixamo.

This may sound silly but i have watched all the videos multiple times and literarily am a bit over excited. Will there be more videos? Maybe a Unite tutorial video? maybe something like the bootcamp guys did but this time focusing only on character animation(complete Locomotion system), environment & interaction (Parkpour, weapons, 2 character interactions), asset management etc.

@ZIP: Yes an IK Solver similar to that one, but you don’t need to set it up on your arms and legs, it is done automatically for you.

[…] La traduction est approximative à certains endroits car certains mots anglais n ’ont pas leur équivalent en français. Vous pouvez trouver l ’article original ici […]

@Lars: I can see the use for baking down simulation, but for characters, vertex animation does re-target at all, it blends very poorly and can’t apply IK correction on top of it. I gives complete freedom to the artist, but does not integrate well in a game animation pipeline.

@Victor: The license page says that most of Mecanim will be in Unity and only some specific features will be limited to Pro. IK Rig = runtime IK rigging for legs, arms and look at.
Additional curves = ability to add user curves on animation clips to help drive script, state machine or IK rig logic

@Robert Lanciault the license page is very cryptic. What are ik rigs? what are layer and additional curves?

@Matrix: YES! There is a minimum amount of memory needed per character instances, but the animation assets themselves can be shared among multiple characters or crowd without extra memory cost.
Unity 4.0 documentation and samples will show to use Mecanim with uneven terrain and other environment use cases.

Hi, good job!!
when we can access mecanim preliminary documentation to see everything we offer this amazing animation system?

You can retarget onto completely different skeleton structures. That is part of why this is so insanely cool.

Do you allows retargeting on differents skeletons structures?
or is it just a ‘scale’ retargeting. and the characters needs the same skeleton.


@Breno Azevedo: This system is not about creating the animationclips inside of Unity. Usually you will take them either from Mocap or from hand made animations in maya / max / motionbuilder.

The purpose of the IK system is primarily to do runtime adjustments to the character on top of the animation data. For example, foot IK prevents foot sliding in transitions and blends. Or you can make the hand of the character grab an object accurately based on where objects are in the world. Optimally you still have some animation data that moves the hand approximately in the direction where you want to grab an object.

It says on the main page of the unity website that Unity 4 will introduce “iterative” lightmap baking .
Can we see some demos about that ?

So to be sure I got this right, lets say you built an ideal generic human state machine for your main character that covers everything your main character can do and has a cost of 100 mb of system memory. You are saying I can get in 10 enemy characters and get them to use the (shooting subset) of the generic set and then civilian crowds and get them to use the (idles, walk subset) of it and all at no additional memory cost?

Also, is it possible to mirror animations to further reduce on memory footprint? (lean left clip being an instance of lean right at no additional memory cost)

Finally, is this character generated in the video already equipped to walk on uneven terrain or stairs (rather than flat surface) with proper foot placement?

@Robert Lanciault, Vertex animation has many uses for me, it allows to you “model” animations in 3d package, as well as bake down simulations of physics and cloth.

No need for bones gives complete freedom of deformations, I could literally brush deformations in a model and then keyframe them. It gives more artistic freedom.

Really nice intro to this new animation tool Will.
The Big Question is :
What will be the difference between the PRO and the Free Version of Unity.
I mean will Mecamim to be available in the Free Version at all?

Thanks for this Unbelievable Add On.

Great system indeed. Though even if the IK solvers are made public, artists would suffer if they try to create their character animations all inside Unity – after all the Animation Window can’t even copy-paste keyframes and there’s no track editor for real production animation work. Not to mention the terrible slow down when there are multi-variable scripts attached to the character. Maybe if these problems/limitations are finally addressed along 4.0, as the animation window stands it would be impractical to say the least.

@Victor: We will provide documentation and samples that cover every aspects of Mecanim. How to use with nav-mesh, to interact with environment, how to do mirroring, manipulate props (weapons), etc.

@Steve: 4.0 gives some ways to solve this problem. A pure IK solution where you adjust mass center and wrists heights to match the ball. Or better, the same IK rig on top of a Blend Tree that blends, lets say, 3 swing animations at different heights. The blend parameter of that Blend Tree would be the wanted height. In that case the IK would only fix minor height error and result looks great!

The IK feature is awesome but being able to configure it can make it usable in any game from restaurant games to fighters. At least the target should be fully configurable.
Having open systems is always awesome. Those parts of unity which are open like editor scripting and most APIs are making huge things but those little parts which were not open historically always made problems, things like font rendering or terrain tree/rock creation and … So Make it OPEN please. However it seems you have the plan to do so

Lets say I make a baseball game and I have an animation for the batter taking a swing. Can Mecanim help me making the animation dynamic so that the height of the swing/bat is adjusted to sync with the position of the ball? Or is that part of the API that will not be available in 4.0?

@Robert can you ask one of the unity FBX coders to add vertex animation import?
I think FBX already support this, just not the unity part.

@Robert: OK, that’s what I suspected – but in that case you’re going to be making animators go through and set up all their IK parameters *twice*, once in Max/Maya and a second time in Unity.

Even if you don’t have immediate plans to remedy that, do you at least acknowledge that it’s not the best possible workflow? Or am I missing something?

@Valentin: from my previous post:

“Muscle space is not available in public API… yet, but it is totally “open-able”. We did some internal tests where we converted ragdoll simulation to muscle space and blended it with animations in State Machine. It will be made available in future version.”

This would also enable you to drive characters from live animation.

@Richard: The boring part of creating and attaching the IK solver on arms and legs is done automatically. The fun part of activating/adjusting IK goals to fix/tweak in game animations is left to the animator. Nothing procedural in there.

@Lka: We did not profiled on all platform yet, but for early tests on ipad2, we were able to run100+ characters at a decent frame rate.
From earlier Joachim’s post:Unity 4.0 focuses on biped character animation. We are putting all energy on solving that problem as best & optimized as we can.
We will add support for non-biped animations in the 4.x series. In 4.0 the old animation system remains for now, so you can use the old system for non-biped characters until then.

Man this gona help a lot the character animation. Unity is becoming better and better everytime i check your updates.


@Robert: How do you determine IK constraints, then? Are you saying that artists will not need to do *any* tweaking or adjusting to get the best looking results?

Pretty much any time someone’s shown me a procedural system like this, it’s fine for getting a rough cut, but getting true triple-A quality out of it requires animator attention.

@Richard: Max/Maya ik-rigs animations are baked on FK when imported in Unity. There is no plan to import Maya/Max IK setup in Unity. Mecanim IK-rigs are automatically created in Unity, no setup needed.

[…] about Mecanim, the upcoming Unity 4 character animation system. Check it out : Tweet TAGS » Character animation, Featured, Mecanim, […]

I was wondering how this works with the nav mesh system eg controlling speeds etc.
Will there be a teaser video on how environment animations are done? eg wall vault?
Will interactable obstacles like vaults etc require special mecanim treatment or are they user handled?
Is there an animation mirroring solution?
Will there be support for creating and utilizing additive animations?
Does the character rig/avatar come with a weapon solution like unreal’s weapon bone?
Can custom blend nodes,states and transitions be built by users through polymorphysim?
Does it also encompass the ragdoll builder?
Should the user want to use unity’s animation builder can the mechanim rig and ik be used in the editor?
Can physics be used in the system for example driven ragdolls or blended ragdolls?
How much documentation and examples can we expect?
How encapsulated is the system? Previous unity animation system was very strict and hidden.
Is there any editor support or parametric animations? //Like those meshes EA shows off in every fifa and mma tech video

What are the performances in a 3GS iPhone? The Animator class and the blend tree can be used in code not linked to a biped?

(To clarify: I’m going to have a hard time persuading my animators to do all their rigging and setup in Unity, especially when we’d still be using canned animations for certain situations).

How easy is it going to be for animators to define IK setups in Max/Maya and have those setups come through into Mecanim, keeping relationships, constraints, etc – to the extent that Mecanim supports them?


The IK system is tightly integrated to animation system. The good side, it doesn’t need any setup and API is very simple. On the other side, we could eventually make generic IK solvers available through API.

Muscle space is not available in public API… yet, but it is totally “open-able”. We did some internal tests where we converted ragdoll simulation to muscle space and blended it with animations in State Machine. It will be made available in future version.

Can the IK system be utilized for other purposes, or is it tightly integrated with the character animation system? Can you for example manipulate the targets for the hands through scripting? Can you use it to drive a disembodied robot arm?

Also, is the intermediate ‘muscle-space’ animation representation accessible? I’ve been experimenting throughout the years in mixing premade animation with procedurally controlled ragdolls, and it seems Mechanim has quite a couple of internal systems I could leverage/integrate provided the system is open enough.

So I guess my main question is: How open will the various mechanim systems be? :)

IK system also provides a Look At constraint with control over how much upper body, neck, head and eyes will contribute to IK solution.

It is a 2 bone IK system. It is highly optimized, so that you can have hundreds of characters with full IK rigs running with no problem.

Unity 4.0 focuses on biped character animation. We are putting all energy on solving that problem as best & optimized as we can.

We will add support for non-biped animations in the 4.x series. In 4.0 the old animation system remains for now, so you can use the old system for non-biped characters until then.

Comments are closed.