Search Unity

Rigidbody doesn't work with animator

Discussion in 'Physics' started by The-Little-Guy, Jun 3, 2015.

  1. The-Little-Guy

    The-Little-Guy

    Joined:
    Aug 1, 2012
    Posts:
    297
    I have a humanoid that I am trying to set up, and in the top level object I have:
    • Nav Mesh Agent
    • Animator
      • Apply Root Motion = false
      • Update Mode = Normal
      • Culling Mode = Always Animate
    • Script (Sets the destination for the nav mesh agent on start)
    I then have a child object which has
    • Rigidbody
    • Capsule Collider
    When I run the game and have the Animator enabled, the rigidbody doesn't work. When I disable the Animator, the rigidbody does work.

    The only reason I have the rigidbody is so I can use vertical gravity, I don't care about the rest of the features that come with the rigidbody. So, is there a way to either do one of the following:
    • Get the rigidbody to work with the animator
    • Keep the character on the ground at all times
    My game is a basic top down strategy game, so the characters don't jump or do anything other than have gravity to keep them on the ground.
     
    afshin_a_1 likes this.
  2. HiddenMonk

    HiddenMonk

    Joined:
    Dec 19, 2014
    Posts:
    987
    You can set up your character in a different way to get the gravity you desire. This is how unity set up their character hierarchy.
    GameObject named ThirdPersonController (This has the animator, rigidbody with gravity, CapsuleCollider, and scripts for moving the character on it)
    Then the ThirdPersonController has 2 children (Im ignoring the glasses child)...
    1 - EthanBody (This has the skinned mesh renderer).
    2 - EthanSkeleton (This is all the joints. They are gameobjects with only the transform on them).

    In other words, just put the rigidbody and capsulecollider on the root most gameobject. Have the child objects just be the looks of your character.
     
  3. Algebrainer

    Algebrainer

    Joined:
    Apr 7, 2019
    Posts:
    2
    This reply is probably way too late, and you probably don't need it anymore, but I just encountered a similar problem and found a solution. Select the animator component on the game object that is causing the problem and uncheck the box that says "Apply Root Motion".
     
  4. inpeckable891

    inpeckable891

    Joined:
    Jul 4, 2021
    Posts:
    4
    you mean check theapply root motion? cause that worked for me
     
    thomasliew37 likes this.
  5. awsapps

    awsapps

    Joined:
    Jun 15, 2021
    Posts:
    74
    It says "Handled by Script", (I'm using Ethan) how do you uncheck that?
     
  6. Rusted_Games

    Rusted_Games

    Joined:
    Aug 29, 2010
    Posts:
    135
    That means that in the script there's the OnAnimatorMove method, so probably the animations are setup with rootmotion