Mechanim for simple animations?

Hi there,
I’m totally new to mechanim, and I’m having a lot of difficulties understanding it.
I need to use an animation system just for simple animations (let’s say rotating an object, opening a crate, something like that). I know probably scripting the movements is easier, but I somewhat like the idea of having various animations that I can trigger on state changes.

My questions:

  1. Do I need a bones system even for those simple animations (like opening a door) or is it possible to do that just animating the transform/rotate values?
  2. How can I set up mechanim for those simple animations? Are there tutorials available?

Basically, I’m thinking to use mechanim the way the old anim system was used.

Thank you in advance for all the advice!

  1. Well technically using multiple meshes inside a single fbx file results in multiple transforms that contain their own meshes. You can animate each mesh’s position and rotation and save that to the fbx file. This is simpler than bones and works fine with both legacy and mecanim generic. Technically it works with Humanoid additional bones too but I fail to see why people would use this with humanoids.

  2. In Unity 4.0 you can only import animations directly from fbx files. And you do need to set up a statemachine. Although this may seem like a waste of your time it actually have the benefit of adding flexibility to your solution. You can use the same parameter names and just set the “open” boolean causing the animation system play on any door. You can also later add idle animations to open doors making them waver slightly in the wind. Or even shake wildly when there is an explosion nearby.

There is a shortcut to creating a statemachine by dragging an animation to your model in the scene hierarchy. And we’re internally discussing other shortcuts that would make sense.

Thank you so much, it’s clearer now.
I haven’t understood that you can still use transform animations with mechanim, and yes, the FSM architecture makes A LOT of sense.
Good job!

Yes but… You can’t actually animate anything in Mechanim… er… can you? I see no timeline, no keyframes etc… I see its use for blending animations, but how do you ACTUALLY open the door? (dont say code… Iknow that… 90degrees rotate… bla bla) Why is Mechanim only acepting FBX, when its own system for making animation makes .anim files?

Im struggling with Mchanim, cos I feel like you guys are gonna dump the old way I was completely happy with, but not getting it at all… Where are the character controllers? Why does my chars walk off into space? Theres just to much to learn all at once when you are in the middle of making a game…

One video tut where a robot needs complex tweaking of its collidor just so it can jump over a box… its just not enough for me to get my head around…

Conceptually its seems great, but in practise… I dont hear happy campers…

-A thing like a door you need to animate it inside your 3d Modeller. There is no animation editor with mecanim unfortunately. It takes time to learn a new system so take this step by step and you will manage to learn it. Since you already know legacy you think it is easier and better but give mecanim some time and you will get more used to it. State machine is a very visual tool and should not be that hard to grasp. In the end Mecanim will save you lots of time and allow for more control. Its not perfect as its missing a few features and things exposed in the API but they will add them over time.

-There are no character controllers but its not that hard to make your own and then reuse it.

-Mecanim makes .anim but they contain an avatar which is necessary for it to work, while legacy system .anim don’t have an avatar. That is the difference.

That is one thing that bothers me in mecanim. So essentially every non-rigged/skinned model that will be animated has to be inside a parent in the 3d modelling app before exporting it. Otherwise I cant have a local rotation or local translation animation on it.

With legacy this was done way more easily just by putting the object to be rotated inside a parent inside Unity. Now if I have 50 models to rotate I will have to go and edit those files in my 3D app to put them inside a parent before export. Doesn’t seem like the best workflow ever…Or maybe it is overkill to use mecanim for such simple local animations ?

For now I do those by code instead of using mecanim but would really love a more friendly way to use mecanim for this without having to re-edit 50 files just to add a parent to each of them.

I have just one comment: with Mecanim you can make fifty crates each with unique open animations and your code only says ChestAnimator.SetBool(“Open”, true); The animations can have any name they want, can have several sub states and transitions, can even attempt to open but fail because they’re still locked. So in my projects I am using Mecanim even for doors and chests, but currently this can only be set up using a 3rd party tool.

We do have plans to extend Mecanim to be able to take on every feature of the old animation system. So what you’re asking for is something we’re planning to add, but to my knowledge this is on a road map far into the future, with no current developers attached to it. Its more like a goal of where we would like to end up than something we have an actual plan for.

Thanks a lot for the reply Unlogick. I see what you mean and I agree 100% with what you are saying; Mecanim has saved us a lot of time and the state machine gives you a lot of control, flexibility and ease of use. Its so much more powerful than the old system. You guys have done an amazing job.

I just wanted to say that I’m happy to hear that you are aiming for Mecanim to take on every feature found in the legacy even if it is not in the near future and only set as a goal.

The fact that it can only be set in a 3rd party tool, to be honest is probably just a minor annoyance so I totally understand why it is not a high priority versus other features.

There is an animation kit for mecanim humanoids : http://forum.unity3d.com/threads/203298-Mecanim-Humanoid-Animation-Kit

However, if you are wanting to generate non-humanoid animations, this would require most of the techniques covered in the Kit though applied to fit the context of the non-humanoid scenarios of cause.

Just thought I would mention the existence of at least a Humanoid animation kit as I’m sure some people would be looking here for any information on this as well. If there were a strong enough demand for non-humanoid animation I might consider putting together a package to assist in this as well though when you break away from humanoids, it becomes a very broad array of possibilities which would be difficult to cover with a single Kit.

stop spamming the board!

It’s not spamming when the information I am providing is contextually relevant to topics I am posting in. I am simply locating areas where there is a need for information about this and where I am also able to assist others with what I know and responding.

Your response to this topic is more in line with a spam post considering it adds no valuable content to this discussion. It would be appropriate for you to refrain from making posts in topics that do not contribute to the theme of the discussions please.

I remember in the asset store > complete project, you can find the 3D platformer tutorial.
In there they show you how to make a basic animation on the spaceship in unity.