Mecanim issue

I’m sure this one’s not a bug but an issue with me or the animations, but i made something simple (import a character, import an animation, create a controller and apply it to the character, only have 1 default animation in the controller).
The animation works just fine but i’m having the following issue

  • If i leave the char at 0,0,0 things work fine and i see the animation
  • If i hit run and then move the char to 5,5,5 things work fine, the character is moved to 5,5,5 in the world and everything works
  • If i move the char to 5,5,5 first and THEN hit run, the char gets moved back to 0,0,0 in run mode! basically anything i do in design mode gets reverted to being placed at 0,0,0 when i go into play mode!
    Any idea where i could be messing up?

Unchecked apply root motion and it now works as expected, guess i need to read up on this first!

Ok did some reading and i’m clueless, could really use some help as i don’t think i’m finding the expected behavior, i’d like to be able to place my char anywhere in the world in the editor and not have it revert to 0,0,0 when the animation begins.

Sounds like your object is animated to 0,0,0.

Animations contain positional data. If you want to move an animated object, you must either refrain from animating position in the animation software, or you must make the animated object a child of a positioning object, or you must remove the Animation component from the object.

I’ve really gotta bind this answer to a key combination…

Shouldn’t the object position be animated relative to where it is placed in the world? I simply purchased the animations and know nothing about animation software. Just trying to apply them as is to characters with mecanim

Nope.

My guess is animation is more efficient if Unity just uses the current transform matrix on it (i.e. the child-parent relationships) rather than trying to store an original position. I haven’t looked into it at all.

Not if the root of the character has a keyframe set at 0,0,0 in the world - even if it’s only one keyframe. The root is usually just the top of the heirarchy - a convenient way of grabbing everything at once. Depending on the animator or the package it came out of, the root may or may not have keyframes set on it. Telling Unity to ignore any animation on the root (unchecking Apply Root Motion) is usually the way to go on items that the player will be controlling.

You could parent the model to an Empty Game Object and then move that object anywhere in the world. Effectively, you’d be making your Empty Game Object the new “0,0,0” (world origin) as far as your model is concerned.

Do i lose any mecanim/animation functionality if i uncheck apply root motion? Creating an empty parent for everything that has an annimation sounds pretty bad

You shouldn’t lose anything if you’re going to use a controller to run your character. You kind of want the controller to take care of moving the character around and letting physics make them respond to gravity, etc - that’s it’s job :wink: