Search Unity

[Solved] Root Motion with Rigidbody and gravity

Discussion in 'Physics' started by Mormel, Sep 2, 2015.

  1. Mormel

    Mormel

    Joined:
    Jan 15, 2015
    Posts:
    6
    Hello,
    I made a simple walkcycle with root motion. So the forward movement is completely controlled by the animation (Y root transform was baked into the pose). At this point everything seemed to work normally. When I tried adding a rigidbody and a collider, it moved at the same speed, but activating gravity slows the character down considerably. Now the animation looks bad and the character moves really slow. Making it kinematic fixes the problem, but then the character of course ceases to properly interact with other rigidbodies.
    So my question is basically how do I fix this. Why is gravity slowing down the animated walkspeed?
    Importing the armature as Generic or Humanoid made no difference in that regard.
    Please help me
     
  2. gorbit99

    gorbit99

    Joined:
    Jul 14, 2015
    Posts:
    1,350
    Could ypu post the moving code?
     
  3. Mormel

    Mormel

    Joined:
    Jan 15, 2015
    Posts:
    6
    Thank you for the reply.
    Actually there is no movemet code at all, since the movement is animated with root motion. I made a small example. When you watch the test object it moves exactly two squares. But when activating gravity in its rigidbody component, it moves a little less. It may not seem that big of a deal in this example, but all my animations look really unnatural and the problem seems to get more severe when the root motion is more complex. Maybe there is some friction happening, but how are you supposed to cope with that while animating?
     

    Attached Files:

  4. Mormel

    Mormel

    Joined:
    Jan 15, 2015
    Posts:
    6
    Hello again, I just found the problem. Without an assigned physics material there seems to be some friction by default. Adjusting these values solves this issue mostly.
     
  5. Serepa

    Serepa

    Joined:
    May 15, 2015
    Posts:
    32
    Hey, did you try to switch ON AnimatePhysics in animator settings?
     
  6. RahulH2799

    RahulH2799

    Joined:
    Nov 28, 2019
    Posts:
    1
    Thank u very much .This helped me after a long time :)
     
  7. TrueSoSense

    TrueSoSense

    Joined:
    Sep 10, 2021
    Posts:
    13
    Wow thanks, switching AnimatePhysics worked for me.
     
  8. NexysStormcloud

    NexysStormcloud

    Joined:
    Jul 26, 2017
    Posts:
    3
    Hello there,
    can anyone advise, I use root motion to move rigidbody, and it is fine in general, but there is a problem with the jump: during the jump animation clip, the rigidbody ignores gravity, in addition to this, if there is a root reversal in the animation (roll, vault), then rigidbody behaves unpredictably. is it possible to temporarily disable root motion following in rigidbody?
     
  9. bobadi

    bobadi

    Joined:
    Jan 3, 2019
    Posts:
    674
    NexysStormcloud likes this.