Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Animator root motion or character controller?

Discussion in 'Animation' started by Zexanima, Sep 20, 2014.

  1. Zexanima

    Zexanima

    Joined:
    Jan 2, 2014
    Posts:
    33
    I have been moving my character with CharacterController.Move() so far. However I've gotten to the point of adding a jump animation. Apply Root Motion would be great for this as it's a complex jump animation, however, with apply root motion it ignores physics.
    1. Is there a good way to to get the CharacterController to follow along with a complex jump animation? (Slow down, flip, then land taking a couple steps to slow down)
    2. Is there any way for physics to work with Apply Root Motion? (Going up steps, running in to walls, falling)
    An answer to either question would help me greatly.
     
  2. Mecanim-Dev

    Mecanim-Dev

    Unity Technologies

    Joined:
    Nov 26, 2012
    Posts:
    1,670
    Yes you can, for clip that the height of the character change during the clip you need to change the importer option: root transform Position (Y).

    Basically what this options does is it control how the gravity affect this clip.
    When On the gravity will affect your avatar when playing this clip.
    When Off the gravity won't affect your avatar when playing this clip.

    In your case you want to put this option at Off because your jump already emulate the gravity.

    If you want more control over this you can create a GravityWeight parameter on your controller, this is a special parameter that control how physic affect your animation, And you can add an additionnal curve on your jump clip that drive this parameter, it start at 1 when the character is running, then goes to 0 when the character lift off the ground and goes back to 1 when it land. Take a look at this screen shot

    gravite.png

    Best regards,
     
    FurionK likes this.
  3. IsGreen

    IsGreen

    Joined:
    Jan 17, 2014
    Posts:
    206
    I think you can not use CharacterController component in mecanim(Animator component).

    Mecanim need rigidbody and collider to apply root motion.
     
  4. Mecanim-Dev

    Mecanim-Dev

    Unity Technologies

    Joined:
    Nov 26, 2012
    Posts:
    1,670
    @IsGreen
    Of course you can, we have demo with an Animator component and CharacterController.
     
  5. IsGreen

    IsGreen

    Joined:
    Jan 17, 2014
    Posts:
    206
    I was wrong. You are right.
     
  6. BrutalDumbass

    BrutalDumbass

    Joined:
    Jul 10, 2017
    Posts:
    7
    Could you please link that demo?
    I did a script based movement but couldn't implement damping well and worry about animation.
    I want to use root motion on the ground but control in the air through .Move and simply blend the animation based on the velocity. But I can't get them to work. Using ApplyRootMotion teleports the player to the coordinates of the animation. I animated in Unity to quickly test out root motion and work on the gameplay right away
     
    MassimoFrancesco likes this.
  7. charles_xl

    charles_xl

    Joined:
    Oct 4, 2016
    Posts:
    58
    Apologies for necroing an old post, but is there no way to have characters moving with root motion respect collisions? Does collision detection have to be calculated manually this way?
     
unityunity