Search Unity

How to return control to physics

Discussion in 'Timeline' started by nepoez, Nov 10, 2017.

  1. nepoez

    nepoez

    Joined:
    Sep 11, 2011
    Posts:
    294
    Hi. If I animated a character throwing a ball do I have to animated the balls entire animation? Or can I at some point disengage timeline from controlling the ball and let physics take over?

    e.g. I animated a character's throw animation.. I animate the ball going along the same path as the arm, then when throw animation is over I animate the ball flying at a certain direction.

    At some point the ball will hit a wall and bound and gravity also should affect it, however animating all that would be a pain, it would be good if I can let physics take complete control after the ball leaves the hand.

    How would we do that in Timeline?
     
  2. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    883
    If the last clip has no PostExtrapolation, then timeline will have no weight afterwords. You could write a custom script that enables physics on the ball and sets the appropriate force and place it in timeline after the throw animation.
     
    nepoez likes this.
  3. nepoez

    nepoez

    Joined:
    Sep 11, 2011
    Posts:
    294
    How about parenting. Let's say I want the ball to be parented to the character's hand for some time.. then when thrown I want it to be unparented. Then later on the character picks up the ball again so I need to parent it again. Would I also write a custom script for the timeline for that?

    Thank you.

     
  4. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    883
    Yes, that could work as well. The DefaultPlayables on the asset store has a track that tweens between transforms. You can use that as example to make a track that reparents.