Search Unity

Root motion - different velocity in Maya and Unity

Discussion in 'Animation' started by KnightPista, Mar 17, 2017.

  1. KnightPista

    KnightPista

    Joined:
    May 18, 2015
    Posts:
    40
    Hi all!

    Our artist creates run animation in Maya, which translates root bone in 22 frames by 4 m.
    However, when importing the animation into Unity, the "average velocity" z component is 4.922.

    As average velocity is computed per second, I expect that the final average velocity would be (30/22)*4 = 5.45
    But the average velocity in the animation window is 4.922.

    Does anybody know a way we can get the exact root motion velocity as in Maya?
    When exporting from Maya, the units are set to Default. Scale Factor in Unity is set to 1 and File Scale to 0.01.

    Thanks a lot!
     
  2. KnightPista

    KnightPista

    Joined:
    May 18, 2015
    Posts:
    40
    Update:

    when I manually set "Root Motion Node" to the node the artist is moving (TSMGWorldJoint), the "Average Velocity" Z value changes from 4.922 to 5.223. Now when the character moves 4m in 22 frames, it should move (30/22)*4 = 5.45 m/s, which still does not match the new Average Velocity.

    Can somebody explain how this Average Velocity is calculated?

    Now let's say the velocity of the run motion is 5.223 and I want the character to be running 4.5 m/s in game. So I change the animation speed to (4.5/5.223)=0.861.
    However, when I checked by code the distance character moved per second, it was not 4.5 m/s but slightly more than that! I then found that in our Animator, the "humanScale" was set to 1.09398448f. So I adjusted the animation speed by that number and now the movement values in game are somewhat around desired value.

    What values can modify the "deltaPosition" value the Animator is reporting us in the OnAnimatorMove (except animation speed of course). Can "humanScale" change the final movement velocity of the animation?
     
  3. SethMeshko

    SethMeshko

    Joined:
    Sep 20, 2014
    Posts:
    109
    Check the framerate that your animator created the animations at. Default in maya is 24 fps but unity likes 30.
     
  4. KnightPista

    KnightPista

    Joined:
    May 18, 2015
    Posts:
    40
    I've checked and Maya is set to 30 fps.
     
  5. SethMeshko

    SethMeshko

    Joined:
    Sep 20, 2014
    Posts:
    109
    Check the scale in maya, is it set to meters?
     
    theANMATOR2b likes this.
  6. DavidGeoffroy

    DavidGeoffroy

    Unity Technologies

    Joined:
    Sep 9, 2014
    Posts:
    542
    Yes. If the avatar you use to import the animation and the avatar you use to playback the animation have different scales, then you won't get the same root motion.

    The root motion gets multiplied by humanScale, so that you don't get sliding when scaling down or up animations using the retargeting.

    If your avatar is setup correctly, your root motion should be the same as in the original file*
    With the default options, Unity will generally try to figure out a root motion based on the centers of mass of the character.
    If you set the root joint, and your import avatar matches, then you should get the same root motion.

    *for the same frame ranges, accounting for the tangents at the first and last frames.
     
    furquijos and haoxiner like this.