Different ways of animating a character for Mecanim

Heya Unity people…

I am wondering about something here and i wanted to post one thread, to see your opinion.

Below i will give examples with some games that are on the market, i guess there’s nothing wrong doing that :slight_smile:

For a game which involves characters and such, what i think at the moment, there are 2 ways to animate one character:
1: Animate the character (Walk, run, jump) at the middle of the scene in the 3D software (Maya, Max, etc) and then make that character move in Unity by script.

2: Animate the character (Walk, run, jump) NOT in the middle of the scene, but actually moving from the center in the 3D software and then just activate \ deactivate the animation clips in Unity, without scripting the movement.

I have been working on one first person game untill now, which had a lot of characters and all of the have been animated by moving away from the center of the scene, meaning no scripted movement in Unity, only activating \ deactivating animations.

At the moment my question is regarding side view game (2D styled, 3D game like Oddworld Abe, Cordy, etc).

In the oddworld Abe example, in my opinion the character was animated, to move away from the center of the scene, because if you pay attention, the Abe is making exact steps in the scene.

For example if he wants to pull some handle or the ropes of an elevator, or go downstage he stands on the exact position for doing that, which will be pretty hard if the movement is scripted in Unity, because if we press and quickly release the walk button he will start walking and stop, which will move him just a small amount from the actual distance, that he is moving in a full step. Thus when we press the forward button and quickly release it, the Abe is making exactly one full step and it doesn’t matter how quickly we will release the button, he will allways one full step and then stop.

On the other hand is games like Cordy. Herein my opinion the character was animated to walk, run, jump, on place and then the movements are scripted in Unity, but here you cannot limit the character to move exact distance if the player quickly press and release the button… (Or can we?)

So my question is,
1: Is there a better way for doing that or it’s just a matter of what we need to be done in the game. If i use the first way, by moving the character away from the scene, will i be able to know via code, at which direction the character is looking, etc…

2: For games like Temple Run, will i need to make different animations for the slow and faster run’s? Or i can just control the speed of the running animation clip, if i want to make the character run faster…

cheers

I just added Mecanim to my platform controller (2D/2.5D), because the controller completely controls motion it needed to ignore root motion in the animations. It worked out pretty well.

The exact positioning problem could simple be tackled by ensuring the controller moves an exact distance corresponding to the animation. There’s no real difference telling your root transform to move through code or through an animation (although of course you would need to synch them).

Adding a version of the controller which uses root motion is something on the agenda for me too, but I think its going to require a somewhat different approach.

If you are an animator then the root motion approach is probably easier, but your movement is going to be very tightly tied to your game (i.e. you can just grab animations form stores and expect them to fit).

PS Hope thats not too much like an advertisement, just happened to be very relevant to what I did last week :slight_smile:

When using root motion you can also add velocity with a script, so the two alternatives are not really exclusive.

Note that in my experience root motion has some bugs with additive animations, so you might not be able to use additive animations properly with root motion activated.

The root motion for the needed animations can be easily ignorred for the Character Controller \ Collider, by activating the BakeIntoPose for the Y or XZ axis.
This way you can make the character controller to move only with the animations you need it to move.

Staross: By additive, do you mean to merge 2 animations in the same time? I was wondering if that’s possible with the Mecanim… For example if i want to have the character’s legs running and then change the motion, that he is going only with the arms \ upper body. Or do i have to make entirely separate animation for every different motion, even if it’s only the hands moving differently…

You can add two types of layers in mecanim, additive or overwrite. What you describe is overwrite with a body mask for the upper body only. Additive layers will just add the animations together, but I never managed to make them work correctly with root motion activated. Take a look at the doc: