Search Unity

Question Root Transform Position (XZ) Loop Match issue

Discussion in 'Animation' started by fourthrones20, May 13, 2021.

  1. fourthrones20

    fourthrones20

    Joined:
    Sep 21, 2019
    Posts:
    10
    Why isn't the animation looping? I made a running animation in Blender for inverse kinematic. The whole skeleton runs in place, movement in space is given only by the Root bone - father of all other bones, which I assign as the root bone in Unity ( in Rig FBX import setting Tab ). But the animation doesn't match XZ position loop. I do not understand - why?

    My running animations I made in Blender - video preview. ( side animations are slightly different - it`s ok)

    I tested it in the game ( you can watch the video ).
    Red Sphere - Position of whole object that takes position of Root Bone ( Apply Root Motion in Animator setting do it ),
    Green - Position of root motion.
    All other Spheres represent different vectors from mouse pos ray cast.

    Position of object ( Red Sphere ) lags behind the root bone ( Green sphere ) and it cause problem because we see how further loops of walk animations start at position behind and it cause teleport back effect.


    Loop optimization graphs

    Blender bone orientation + FBX export settings.

    Root Bone assignment.


    Code block that execute inverse kinematic ainmation in Blend Tree:
    float blendTree_X = Vector3.Dot(target, transform.right);
    float blendTree_Y = Vector3.Dot(target, transform.forward);

    anim.SetFloat("X", blendTree_X, 0.1f, Time.deltaTime);
    anim.SetFloat("Y", blendTree_Y, 0.1f, Time.deltaTime);
     
    Last edited: May 13, 2021
  2. bobadi

    bobadi

    Joined:
    Jan 3, 2019
    Posts:
    674
    your xz motion on the animation isn't baked, right?

    don't know, but might be some useful info here
    Animator Root Motion playback has changed in 2018

    I'm interested to know if root node (not hip root) animations work alright, it's quite a work to inspect if root motion was authored on root or hip and most of the clips have root motion on hips.

    isn't it the timeline what's causing the weird behavior?
     
  3. fourthrones20

    fourthrones20

    Joined:
    Sep 21, 2019
    Posts:
    10
    I made a stupid mistake. My problem was solved by the fact that I just added an avatar to the animator + there was a problem with the fact that my idl animation did not have the same duration as other animations in Blend Tree - This caused incorrect animation of the bottom line movement and problems with the root motion.
     
    Kaelle likes this.