Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

[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,175
    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:
    24
    Hey, did you try to switch ON AnimatePhysics in animator settings?