Search Unity

Root Motion for Timeline Player Animation

Discussion in 'Timeline' started by luch85, Apr 25, 2019.

  1. luch85

    luch85

    Joined:
    Apr 7, 2019
    Posts:
    5
    I've created an intro animation sequence using Timeline. The sequence animates my player(character) model using root motion.

    upload_2019-4-25_7-21-42.png

    I want the player to be controllable at the end of the sequence. So I added a third person controller to the same character object.

    upload_2019-4-25_7-25-9.png

    The controller script that I took from Standard Assets took control of the Root Motion, and now when I play the sequence back on the Timeline the Character plays out the animations in one spot.

    norootmotion.gif (moving in one place after adding character controller)

    How do I make timeline play the root motion animations on the character?
    How do I take controls away while the timeline animation plays out?
    And then how do I give back control to the player once the animation sequence is done?

    Thank you!
    - Luc
     
  2. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    2,445
    You can enable and disable the different / conflicting components via a script. So when you want the user to be in control, enable the character controller and disable the timeline. And vice versa: when in a cut scene, disable the character controller and enable the timeline.

    It would be nice if there was an "activation clip" type which let you flip on or off individual components, but alas, activation tracks appear to only cover whole gameobject's activation.
     
  3. luch85

    luch85

    Joined:
    Apr 7, 2019
    Posts:
    5
    Thanks for the reply. But even if I disable the Third Person controller scripts, the animator still doesn't give root motion.

    There's gotta be a straight forward way this is done, I mean, I don't think I'm the first to need to give back root motion to a player character.

    Seamless cutscene to gameplay is what I'm looking for.
     
  4. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    Timeline supports going from animator controller->timeline->animator controller. The third person controller scripts implements OnAnimatorMove() which will override the root motion, even from timeline. You may need to add a flag to that script to have it call Animator.ApplyBuiltinRootMotion() when you default root motion to be applied, like when the timeline is running.
     
    pango and luch85 like this.
  5. luch85

    luch85

    Joined:
    Apr 7, 2019
    Posts:
    5
    Thanks for the help, I'm a novice, do you think you could share an example of that?