Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Root transform being applied to body transform on non-looping clips

Discussion in 'Animation' started by nesrocks, Sep 2, 2014.

  1. nesrocks

    nesrocks

    Joined:
    Dec 27, 2012
    Posts:
    4
    Hello all. First of all I just wanted to say that we've been using Unity3D for our project and we're impressed with mecanim and Unity3D as a whole.

    We have prototyped our character and we thought we had the hang of how mecanim works. Now I've started organizing the 3ds max main character file so I can do the final version of the animations, but I've discovered a problem I can't get around.

    I have several animations for my 3D game, for example:
    - no root movement sequence: idle (loop), idle jump (non-loop), idle falling (loop) and idle landing (non-loop);
    - Z root movement sequence: run (loop), run jump (non-loop), run falling (loop) and run landing (non-loop);
    The blending between these is managed by mecanim's blend tree, driven by the character's forward speed.

    I have made a custom bone rigged character as CAT is too buggy and biped is... old. I have managed to get great looking facial animation using nothing but a few bones and all animation is exported perfectly to Unity3D. edit: scratch that, not all facial animation is being exported. edit2: It now works, I just had to click "fix mask" on every clip.
    The rig's hierarchy at the top is:

    - "scaler control" (this is the parent of all the rig and is where I animated the root movement ->
    - child of scaler control: "general control" (this is for when I want to move the character, but not affect root movement it turns out I'm not using this much) ->
    - childs of general control: head control, hand control, foot control, etc, and hip control ->
    - child of hip control: bone_pelvis (the actual bone mecanim recognizes as part of the rig)

    Animation type is humanoid and every bone is correctly mapped.
    On animation clip - motion - root motion node I have "none". If I choose the scaler controler for this, the character rotates 90º and faces down on the ground.

    The problem:
    I figured I had to tick "Loop pose" on every clip because that's how root motion worked and that's how we tested. But that was obviously creating serious animation artifacts on non-looping clips. So I don't want to loop pose on those clips but if I don't, unity3D duplicates the result of the root motion to the body transform, as a child of the root transform, resulting in the character moving twice as much as it should and getting off of its correct transform axis.

    root-looped(wronganimation).jpg root-looped(wrongrootanimation).jpg
    image 1: loop pose ON. The root motion works, but the animation can't possibly reflect how it was on 3ds max. Notice the knee bended awkwardly and the pose being totally different from image 2.
    image 2: loop pose OFF. The animation is as in 3ds max, but the root transform moves, and the body transform undesirably moves too.

    jump_animation_settings.jpg

    Solutions I've considered but are problematic:
    1. Making only looping animations when I need root transform: this is impractical, my game needs non-looping animations.
    2. Making the character's root move half as much on 3ds max, so half * 2 = the correct movement I want. The problem with this is that the character gets away from its axis.

    With this, the animation production has come to a halt. We'll continue to look into the problem, but it would be great if someone could spot what we're doing wrong.
    Thanks in advance.
     
    Last edited: Sep 3, 2014
  2. nesrocks

    nesrocks

    Joined:
    Dec 27, 2012
    Posts:
    4
    For testing purposes, I have created an incredibly simple custom bones based rig with a spline controler on top of it all, animated a non-looping clip that moves forward and it exported perfectly to mecanim. So it has to be some incompatibility between my complete rig and mecanim.

    Also, if instead of humanoid I choose generic, and choose the child of the topmost hierarchy member to be the root node it seems to work. Although the documentation says it's recommended to have a humanoid compatible rig, I think I'm going with this solution for now.
     
    Last edited: Sep 2, 2014
  3. nesrocks

    nesrocks

    Joined:
    Dec 27, 2012
    Posts:
    4
    Ok, I've read a bit more on how to set up a character for mecanim, and the documentation says:
    "To work with Mecanim, the hips should be the root element of the bone hierarchy."

    I think this should be clarified. Does this mean that the hips just shouldn't have any bones above it on the hierarchy, or that it shouldn't have anything above it? Animators constantly include shape controllers on their workflow and it can be cumbersome to do keyframed animation without them.

    The sad thing is, my rig is fairly complex and complete. It uses IK solutions, custom attributes modifiers, wired parameters, position and rotation constraints, and everything exported to mecanim humanoid almost perfectly. Except for the root transform on non-looping animations.

    Everywhere I read that we should just use biped or mixamo and I think those solutions are great depending on your budget, but I think Unity3D would go to the next level with a little more support to customized rigs.
     
    Last edited: Sep 4, 2014
  4. Mecanim-Dev

    Mecanim-Dev

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    I would suggest you to read this article about humanoid rig
    http://blogs.unity3d.com/2014/05/26/mecanim-humanoids/
    this will help you to create a rig compatible with mecanim.

    Root motion work for both looping and non looping clip, this two option: looping and root motion are not related.

    You can have any bone/transform between the hips and the root node, unity will bake animation for all these in between bone on the root.

    If you can't get it to work, PM and we will work togheter and see what going on.

    best regards,
     
  5. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,068
    I have the same problems as OP with ticking "Loop pose"
    You can see my video https://forum.unity.com/threads/generic-rig-animation-root-node-root-motion-problems.1429021/

    I'm using generic rig and I don't want to use humanoid rig, since I will use non humanoid characters later.
    Now is root motion only working with humanoid rig ?