Search Unity

  1. The 2022.1 beta is now available for testing. To find out what's new, have a look at our 2022.1 beta blog post.
    Dismiss Notice

Gravity and root motion

Discussion in 'Animation' started by angrypenguin, Jan 18, 2014.

  1. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    14,230
    Is there a way to stop gravity from being applied with root motion?

    I'm using .anim files from Mixamo, so I can't change the curves to modify the gravity weight parameter as per the video tutes.

    The gravity variable on the Animator is read-only, so I can't change it there.

    I can change Physics.gravity, but that of course messes with all gravity, which I do not want.

    My current hack is to disable root motion from relevant animations where gravity weight is larger than zero, but that messes with the movement so I have to then apply additional hacks to fudge it back in, which not only looks dodgy but makes the code a mess.

    I suppose another hack I could try is reading the public gravity variable on the Animator and then adding the negated value to the transform each frame. This also sounds like a mess and could have unpredictable results... but I guess it might at least keep the mess to one place.

    Any other ideas?

    Cheers!
     
  2. frankrs

    frankrs

    Joined:
    Aug 29, 2009
    Posts:
    298
    there's a checkbox on the animator component, "Apply root motion" try unchecking that
     
  3. PrimeDerektive

    PrimeDerektive

    Joined:
    Dec 13, 2009
    Posts:
    3,076
    I encountered a similar issue (although not quite the same, but involved using curves and editing the start/stop of clips), and concluded that: clips from the in-unity mixamo store suck. If you buy mixamo clips directly from their website (although they're twice as much money), they give you an fbx file with the clip on it, so you can retarget it and actually add curves and whatnot.

    They should really look into make the Unity store plugin do the same thing.
     
  4. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    14,230
    Well, as I said, my current hack is to disable root motion when its applying gravity I don't want. But that's not a good solution as it doesn't do what I want properly.

    Mixamo do make it clear on their Asset Store page that the curves aren't available. Also, as I purchased the subscription, "twice as much" is another $750. (Though I do then get access to Fuse which, depending on the content library, could be incredibly tempting.)

    The problem is more that the Animator can't be effectively controlled. I've been playing with it on and off for a few weeks now, and while it has the potential to be an awesome system there are pretty huge limitations arising from stuff that isn't exposed. Control over the gravity that it applies on your behalf is one. Control over transition times is another (the time slider we have access to is not the whole story). The general inability to make changes to the controller at runtime is potentially another (it's not something I need to do, but I can easily imagine use cases where you might want to).
     
    Last edited: Jan 23, 2014
unityunity