Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Unity animation system not meeting my needs. Am I missing something?

Discussion in 'Animation' started by rorylane, Jun 26, 2015.

  1. rorylane

    rorylane

    Joined:
    Apr 10, 2013
    Posts:
    22
    To demonstrate my dilemma, IA have prepared the following materials:

    1) An interactive application of the tests:
    www.arthavoc.com\AnimTest\animation_test.html

    2) A package containing my test files:
    http://www.arthavoc.com/AnimTest/AnimationTests_Distribute.unitypackage

    3) A video of my tests in motion:


    Here's my issue:

    We are making a game. It will include over 100 characters, each with at least 6 animations. As a cost saving measure, we're intending to lean heavily on motion capture libraries and animation reuse between characters.

    However, our game is an RPG, and the characters vary significantly in shape and proportion. For this reason, we intended to substantially utilize Unity's humanoid rig to transfer animation from one character to another.

    Our needs are pretty simple:

    1) Accurate transfer of animation between similar rigs.

    2) Respectable retargeting of animation from one rig to another of different proportions.

    3) The ability to remove root motion for a looping animation (critical for incorporating motion capture).

    4) The ability to also, when needed, retain root motion from an animation clip within the same overall system.


    This sounded simple enough. In practice, establishing a system that provides consistent results has been pretty tedious. After many weeks of trial and error, I eventually took the step of trying to identify exactly what happens with each combination of settings, but the results have still left me puzzled.

    The only combination that transfers relatively well between rigs of different proportions is Humanoid rig to Humanoid Animation. That's to be expected. However, if "apply root motion" is not checked, you get insane foot sliding and other artifacts. If "apply root motion" is on, then you get root motion applied and the character will gradually drift away, even for animations set to "loop pose."

    I have tried every combination I can think of, and I have, thus far, come up short.

    The only thing that seems like it will work would be for me to customize every animation to every character in maya, and set each of those animations as generic. If I abandon the ability to retarget animation between rigs, then I could just use Generic rigs with generic animation, and save myself the hassle of trying to get the humanoid system to work.

    I'm tempted to just forget about Unity behaving like I expect it to and program my own custom animation class that takes looping into it's own hands, ensuring that I can use the humanoid rig's retargeting capabilities without being held captive by it's looping and root motion application problems.

    But perhaps I've missed something, and I'd be very grateful for any suggestions or solutions I may receive.

    Thanks

    P.S.
    It's unfortunate ".unity" is not an acceptable file format for upload on the Unity forum. It would be very hand to be able to share packages and projects.



    EDIT :SOLVED
    http://www.arthavoc.com/AnimTest/animationtest_2.html
    http://www.arthavoc.com/AnimTest/AnimationTests_Distribute2.unitypackage
     
    Last edited: Jun 26, 2015
  2. Robert-Lanciault

    Robert-Lanciault

    Unity Technologies

    Joined:
    Oct 17, 2012
    Posts:
    14
    Humanoid Animation should fit the needs you stated above. Your problems seems to be more about Root Motion than retargeting itself. Note that at the very end, if you can't get Root Motion right from Animation Settings, there is always the possibility to import Root Motion that comes from your 3D Packages. It will be less work then tweaking all your animation as Generic ones. Most of the time Animation settings give enough control over looping and root motion, so I believe there may be something wrong in your setup. Even if you test scene is quite elaborated, I would still need to look at your project/assets to see where it breaks. Is it possible to share some of your characters and animations with me?
     
  3. rorylane

    rorylane

    Joined:
    Apr 10, 2013
    Posts:
    22
  4. Robert-Lanciault

    Robert-Lanciault

    Unity Technologies

    Joined:
    Oct 17, 2012
    Posts:
    14
    When importing humanoid animation, parts of it will be converted to Root Motion. The Import Animation Setting let you control what will be converted to Root Motion: Orientation, Height or XZ Position. You have a green, yellow or red light on right side that tells you if your animation clip is suitable for each settings.


    In almost all cases you can’t turn off Apply Root Motion in animator and expect the resulting animation to behave correctly. Your Attack animation is a good counter example since all lights are green! It means that everything can be Baked To Pose safely. In this case nothings remains on Root Motion. On my side, doing this for your Attack clip gives good results for both of your characters and also for other random characters I have tested with. You may notice small amount of sliding on the feet that can be easily fixed with Foot IK (enable this on State in State Machine).


    About your Run clip, the Loop and Bake settings can be turned ON except for the Position XZ as the run Clip has motion in Z (and some on X). If you want to get rid of the small drifting on X, you can adjust the Root Transform Rotation Offset. I found that a value of -5.54 removes the drifting. There is a message box bellow the animation settings that displays the Average Velocity of the clip. Adjust the Rotation Offset until you get average speed of 0 on X.


    Both of you clip retargets well on humanoid characters I have tried. Not all combination of setting will work for all clips. Rely on the green lights and results should be good.
     
    theANMATOR2b likes this.
  5. rorylane

    rorylane

    Joined:
    Apr 10, 2013
    Posts:
    22
    Thank you for your reply, and with your assistance, I believe I have got it figured out!


    Although, it looks like, that alone, would give us all three scenerios:


    1) Stationary Loop (Idle, Dance, etc):
    RIG: (Humanoid, Apply Root Motion = Off ) ANIMATION (Humanoid, Bake XYZ & Rotation)


    2) Loop with Root Motion Removed (Run, Walk, etc)
    RIG: (Humanoid, Apply Root Motion = Off ) ANIMATION (Humanoid, BakeY & Rotation)


    3) Loop with Root Motion Preserved (Lunge attack, Jump Kick, etc)
    RIG: (Humanoid, Apply Root Motion = On ) ANIMATION (Humanoid, BakeY & Rotation)


    1) An interactive application of the tests:
    http://www.arthavoc.com/AnimTest/animationtest_2.html

    2) A package containing my test files:
    http://www.arthavoc.com/AnimTest/AnimationTests_Distribute2.unitypackage


    Thanks so much!
     
    Last edited: Jun 26, 2015