4
\$\begingroup\$

I'm using 3ds Max to export character animations in which my character is moving. I expected this to mean that the character will move in Unity, but it doesn't...

For example, if my animation (in 3ds Max) moves my character forward for a second, from 0,0,0 to 1,0,0, in Unity, the character snaps back to 0,0,0 once the animation ends.

Is there a way to change the position of the character according to the animation, without something like CharacterController.Move?

\$\endgroup\$
4
  • \$\begingroup\$ The animation should not move the character. The character should be walking in the animation as if it has a string tied to it's back and it's legs are in the air sort of speak. The movement change where the model is located. The animation itself should not affect that. \$\endgroup\$
    – AturSams
    Commented Feb 4, 2014 at 13:55
  • \$\begingroup\$ is that means i have to separate the animation and the movement? say i produce every animation in the position 0,0,0 at 3dsmax, and the positioning will be done in the code at unity? \$\endgroup\$
    – brian661
    Commented Feb 4, 2014 at 14:19
  • \$\begingroup\$ What version of Unity are you using, and are you using Mecanim or the Legacy animation system? Mecanim will allow you to use the displacement in the animation to move the character. \$\endgroup\$ Commented Feb 4, 2014 at 14:33
  • 1
    \$\begingroup\$ I'd strongly recommend you make all your animations in-place, then use Unity to move the models around. Otherwise you're going to end up with a mess of offsets. Further discussion should be taken to chat however. \$\endgroup\$
    – House
    Commented Feb 4, 2014 at 15:10

1 Answer 1

7
\$\begingroup\$

The prevailing wisdom has been to separate your animations from your movement. I.e. Animate the character in-place and move it via code. Dependent on your game type, this can indeed be the better method.

However, Unity (4.x) provides the Mecanim animation system, which allows for root motion to be applied from the animation to the character's in-game transform. In order for root motion from the animation to be applied, make sure the "Apply Root Motion" option is checked in the animator component.

Mecanim will also retarget animations for humanoid rigs auto-magically. By using the retargeting with root motion, you can use the same animations for a long-legged character and a short-legged character, and the movement will then (auto-magically) line up with the animation.

Skeletal meshes should include an animator component by default as of Unity 4.3, and I believe this is still the case as of 4.3.4.

Using Mecanim will also require you to make an Animator Controller, which is a state machine for controlling your animations.

The Mecanim reference can be found in the Unity manual pages here.

\$\endgroup\$
1
  • \$\begingroup\$ Also, be sure to select the root bone from the "rig" tab after importing the model, otherwise root bone motion will not work (and drive you nuts) \$\endgroup\$
    – Lake
    Commented Jul 13, 2014 at 9:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .