Search Unity

  1. Click here to see what's on sale for the "Best of Super Sale" on the Asset Store
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Mecanim feet skating / model moving not perfectly in 1 direction

Discussion in 'Animation' started by OfficialHermie, Sep 10, 2015.

  1. OfficialHermie

    OfficialHermie

    Joined:
    Oct 12, 2012
    Posts:
    535
    Hello!

    Can anybody else confirm that Mechanim introduces wiggeling when root motion is activated?

    The problem never occurs in the Animation Preview window but only during game play.

    I am not an experienced animator myself, so it is hard to prove.
    I would really appreciate if really experienced animators could jump in.

    I have an animation created in Maya where the model walks forward in a perfectly straight line.
    When I now import the model into Unity and create an animator where the same animation loops, the model will not walk straight forward, but it will over time tend to move left or right.

    Also, I think that feet are never perfectly still when using a Mechanim animator controller in an idle animation where the feet should stay perfectly still on the ground.

    I tried to prove this with the Unity Lab example, but for some reason (or perhaps that alreadys proves the bug), the scientists feet skate unmotivatedly over the floor (as to be seen here):


    I am not talking about the movements where the scientist's feets skate like 20 cm over the floor for no reason (because that might be because the animator forgot to align him to 0,0), but just the micro-movements during an animation.

    Anyways, the quality of these animations made me think that I could not use them for reference.

    Does anybody have an absolutely perfect animation in Maya or any other animation software to prove my assumption that Mechanim introduces such wobbeling / skating?

    Thank you for the help.
     
    Last edited: Sep 10, 2015
    GeneralB likes this.
  2. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,825
    Does it help to change the animation to Bake Into Pose and Based Upon > Original?
     
  3. WendelinReich

    WendelinReich

    Joined:
    Dec 22, 2011
    Posts:
    224
    The specific issue you mention is new to me.

    I use root motion consistently and for a complex character (a dog) with lots of (blended) animations. In general, root motion does what its supposed to do. However, I have one set of animations (walk + curved walk, but not trot or gallop) where the feet wiggle a bit, like with your character. It also occurs in the anim preview, and I've never found an explanation.

    Isolate the issue, then please file a bug report, the issue you're seeing should definitely not happen with root motion. First of all, you can use the standalone FBX exporter from Adobe to verify that the root motion works in the FBX (so its not created by the anim clip). Then try to run the single clip on a character with no additional code, and where the Animator component has root motion enabled (hope you did that already BTW). If its still an issue, file a bug report!

    Wendi
     
    theANMATOR2b likes this.
  4. OfficialHermie

    OfficialHermie

    Joined:
    Oct 12, 2012
    Posts:
    535
    Could anybody else jump in here and try it himself? I am so strung out after having spent so much time on it already.
    I am using Humanoid plus an animation controller with the same animation added twice and linked to each other so that it plays in a loop.
    Preferrably with the Unity Labs scene so that Unity can follow everything.
    That would be really nice, thank you!

    @TonyLi I have tried that but it didn't change the problem.
    Can Unity itself jump in here and tell us something about this problem? They can easily see the problem when they try out their Unity Labs sample project.
     
    Last edited: Sep 10, 2015
  5. WendelinReich

    WendelinReich

    Joined:
    Dec 22, 2011
    Posts:
    224
    BTW, have you tried setting Anim.Compression to "Off" in the import options of the FBX?
     
  6. snoodleking

    snoodleking

    Joined:
    May 2, 2012
    Posts:
    13
    I have the same issue with the skating feet. I've always assumed it was something to do with the IK feet and how they get imported. I havn't been able to figure out how to fix it yet.
     
    Last edited: Oct 11, 2015
  7. snoodleking

    snoodleking

    Joined:
    May 2, 2012
    Posts:
    13
    So I messed around with it some. My case might not be the same as yours, as I'm using a unique rig and therefore using a unity "generic" mecanim rig (imagine a crab rig type thing). I had to do three things to eliminate my feet sliding.

    1). Turn off "Anim Compression" in the import animation settings (in my case I actually left Keyframe Reduction on, but set rotation error to 0).
    2). I had to bake my animation IN MAYA (using maya lt 2016). When I exported from Maya, even with "bake animation" step set to 1, it still gave me feet slide. When I baked the animation in maya, THEN exported, the feet slide went away.
    3). I made sure that all my "Root Transform" options in the unity import were using "origina" and "Baked Into Pose" was checked.

    I hope something in this helps!
     
    theANMATOR2b likes this.
  8. eses

    eses

    Joined:
    Feb 26, 2013
    Posts:
    2,359
    Hi,

    sorry I can't confirm the wiggle thing as described by you but I've got some generic tips.

    First of all, I'll mention that I haven't tried to get very high quality out of mecanim (yet) as I've been more like learning the system, so I haven't run into this kind of issues if they exist.

    1. "the model will not walk straight forward, but it will over time tend to move left or right" - this is a bit vague definition of (perfect) straight forward. What kind of keyframes of your topmost node in Maya have?
    Even if you play a clip that starts from position A and ends into position B, then loops back by Maya animation playback to first frame where character is in position A, does not tell much more else than point A and B are lined up in Z/Y axis to 0 *roughly* for example.
    But in reality hip / whatever is root/translation node might not be positioned exactly and might be also rotated at the last keyframe. Maybe check motion curves in Maya at and after last keyframe compared to first frame? I've messed up many times with this.

    2."the feet should stay perfectly still on the ground" - There's nothing keeping feet exactly on the ground as far as I remember based on reading docs. Animation is stored from root down, it's only illusion that feet or hands end up on some spot, as a result of rotations from root to tips. Already mentioned anim comprission / key reduction and animation itself can break this illusion. Only simple ways I can think of is to glue feet to ground is to add IK in unity using script or use no keyframe reduction when exporting to FBX.

    3. micro-movements - I'm a bit interested about this too, can you record non-working motion instead of this, if this is not what we should worry about. I think I'll test this!

    4. Does anybody have an absolutely perfect animation - I'd think it might be better idea to move character by code (or) overriding root motion, if you really need perfect axis aligned movement. I haven't tested if or if not there is such inaccuracy, but I guess even if you made transitions 0 length, you might have to create really exact animation curves to avoid eventual drifting from straight line.
     
    Last edited: Oct 11, 2015
  9. eses

    eses

    Joined:
    Feb 26, 2013
    Posts:
    2,359
    hermie: Little bit of testing, and it boils down to this;

    Check motion clips settings, Root Transform Rotation:
    1. Original.
    Like mentioned earlier, if using animation as source of straight ahead, it won't result in good
    solution, character will drift away from original movement direction.

    2. Body Orientation. Won't be any better, as I explained above. Character will eventually stray away from original imaginary straight line.

    3. Bake into pose - Use this one. I always have to check what this really means; I don't know what was going on when they named these options... explanation in manual is even more "rocket science" IMO complicating simple thing.
    Basicly it seems to mean that orientation of first frame is used for this imaginary root rotation, and it won't change for the rest of the animation. This will result in infinite straight movement, I think. At least 500m and I was OK.
     
    Last edited: Oct 11, 2015
  10. eses

    eses

    Joined:
    Feb 26, 2013
    Posts:
    2,359
    I did a couple of tests with mixamo dummy + run animation, this is how it looks. However, not actually sure if your problem was something deeper than simply changing this setting, but here they are:

    Root transform rotation, bake to pose: https://db.tt/2TYiWOd7
    Root transform rotation, body orientation: https://db.tt/YNSbevTo
    Root transform rotation, original: https://db.tt/Qh8Lawk2

    About micro-movements - I didn't notice anything strange in slow motion movement so far.
     
    Last edited: Oct 11, 2015
    theANMATOR2b likes this.
  11. GeneralB

    GeneralB

    Joined:
    Mar 2, 2014
    Posts:
    4
    Last edited: Feb 28, 2017
  12. OfficialHermie

    OfficialHermie

    Joined:
    Oct 12, 2012
    Posts:
    535
    I think I found the problem for these mini-whiggles: Does it work when you turn off "Anim. Compression" in the animation inspector? If we're talking about the same issue then it might be the solution.
     
  13. Zahidylin_Marat

    Zahidylin_Marat

    Joined:
    Jul 28, 2012
    Posts:
    113
    No :) Have the same problem with mixamo animations and any of suggestions didnt help.
     
unityunity