Search Unity

Animator root motion and gravity?

Discussion in 'Physics' started by Tarball, Jun 7, 2017.

  1. Tarball

    Tarball

    Joined:
    Oct 16, 2016
    Posts:
    166
    I fall at a 100x slower rate than -9.81 m/s^2 when I have root motion checked on the animator. My file scale to unity scale is 1:1. If I disable root motion, player falls normally.

    The problem is that I need root motion for various reasons. I disabled all animations and just dropped him, and still the slow fall acceleration when root motion is enabled.

    To me, this makes no sense whatsoever. All rigidbodies should be affected by the same gravitational force at all times, animator or no animator.

    Am I missing something here? How can I make root motion and gravity work together? All previous posts I've found have unsatisfactory solutions or none at all.

    Edit: I just changed everything to be not dependent on root motion. This caused another problem of "drifting" after a recent collision, even with max friction. I hate to use hacky solutions like freezing/unfreezing rigidbody x seconds after a collision though. This was the main reason I wanted to keep root motion. Any suggestions are welcome.
     
    Last edited: Jun 7, 2017
  2. albertjames

    albertjames

    Joined:
    Aug 11, 2018
    Posts:
    16
    Late to the party, but this helped me:

    https://docs.unity3d.com/Manual/RootMotion.html


    Root Transform Position (Y)

    This uses the same concepts described in Root Transform Rotation.

    Bake Into Pose: The Y component of the motion will stay on the Body Transform (Pose). The Y component of the Root Transform will be constant and Delta Root Position Y will be 0. This means that this clip won’t change the Game Object Height. Again you have a Green Light telling you that a clip is a good candidate for baking Y motion into pose.

    Most of the AnimationClips will enable this setting. Only clips that will change the GameObject
    height should have this turned off, like jump up or down.

    Note: the Animator.gravityWeight is driven by Bake Into Pose position Y. When enabled, gravityWeight = 1, when disabled = 0. gravityWeight is blended for clips when transitioning between states.
     
    Brother_77 likes this.
  3. zeropointblack

    zeropointblack

    Joined:
    Jun 8, 2020
    Posts:
    197
    anyone figure this out yet?

    albert, that "solution" doesnt address the problem at all. if you check or uncheck root position Y, it disables gravity. so it works, but then you lose gravity.
     
  4. Brother_77

    Brother_77

    Joined:
    Feb 8, 2019
    Posts:
    233

    This worked for me! Thank you!