Search Unity

Blender, Mecanim, and root issues

Discussion in 'Animation' started by Mortis86, Aug 7, 2014.

  1. Mortis86

    Mortis86

    Joined:
    Aug 7, 2014
    Posts:
    2
    Hey folks

    I've been wrestling with a bit of a problem in Unity using Mecanim and a rigged and animated character from Blender.

    I have 1 rigged goblin character with a root bone at 0,0,0 which I use to move him forward for walk and run cycles.
    I've imported it into Unity and setup the Humanoid rig option and everything maps in perfectly fine, no problems there. However, when I play the animation clips on loop, the character's animations play fine but it usually deviates off at angles. So I did some experiments and found that the root of the humanoid rig is the body (at least it seems like it). I had the character in a T Pose, and moved the root bone forwards but didn't animate anything else. Imported to unity with the humanoid rig, tested the clip and there's no deviation off centre as the character moves forwards. I then added rotation to the hips to mimic the movements of a run or walk - again, no problems. I then added rotation to the spine and chest and found that it causes the character to move off centre in the direction of the rotation. I baked the rotation into the pose and this reduced the effect but did not negate it fully. I tweaked the offset but it still varies a tiny bit.

    So here's the real question. Am I actually allowed to rotate the upper torso if I'm animating a forward moving animation to be used with the humanoid rig in Mecanim? If so, I'm disappointed. But I'd also like to know if the rotational information is baked into the pose from the first frame. Would having no rotation on the torso on the first frame mean that I can avoid the character deviating from a central course if it's baked into the pose?

    I've tried my best to word this right in hopes of some help as I have significantly less than I did 2 days ago. Any suggestions would be great. Thanks a bunch!


    EDIT - It's worth adding that it works absolutely fine when using the Generic rig and setting the root node as his actual root bone. I can make do with a generic rig if needs be but I'd like to make use of the masking and such later on so I'd definitely prefer the humanoid rig.
     
  2. Mortis86

    Mortis86

    Joined:
    Aug 7, 2014
    Posts:
    2
    Thought I'd post back for anyone else wondering about this.

    I've set the first frame of the animation so that the upper body rotation is centred and pointing directly along the Z axis with no rotation applied. So my first frame is actually half way through a walk cycle where the body is centred. It then rotates with the shoulders for the rest of the animation. If I set the Root Transform Rotation to Based Upon: Original, and activating bake into pose. I don't get any deviation off centre using this setup.

    So for those who don't know already, make sure your first frame of the animation has the body without any rotation and save any chest sway for later frames.
     
    Mecanim-Dev and OllyNicholson like this.