Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Using Animation Clips Resets Child Transforms

Discussion in 'Timeline' started by joebain, Sep 3, 2019.

  1. joebain

    joebain

    Joined:
    Oct 24, 2014
    Posts:
    47
    I'm still getting used to Timeline but I'm having a problem and I'm not sure if this is down to me doing something wrong or not understanding, but maybe someone can help.

    I have an animation track which plays 3 animation clips. The first moves a gun turret up out of a hatch, the second opens a flap below, and the third moves the turret down so it is now looking out of the flap. The two turret clips only have keys for the turret and the flap clip only has a key for the flap. I play the three clips in order and what happens is:

    * The turret moves up
    * The flap opens and the turrent snaps back to it's original position
    * The turret snaps up then moves down, and the the flap snaps closed again

    It seems that when an animation clip plays the effects of the other clips are undone. This is kind of like if I have "Write defaults" ticked in an animation controller state. But there seems to be no analogous setting in Timeline. Is there a way to get this behaviour or do I need to include keys for all the objects in every clip?

    Timeline:
    timeline-setup.png

    Target animation:
    target-animation.gif

    Current result:
    current-animation.gif
     
  2. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    You might need to match the offsets of the clips. If one clip affects the root transform, then all clips on the track will. Right clip on the 2nd & 3rd clip and select 'Match Offsets to Previous Clip'.
     
  3. joebain

    joebain

    Joined:
    Oct 24, 2014
    Posts:
    47
    Thanks for the suggestion, but it doesn't help unfortunately. There is nothing affecting the root transform in these three clips.
     
  4. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    ok, Try using override tracks. ClipA on the top track, ClipB on the next track, ClipC on the next track. And use post extrapolation on each clip. (turn off ClipB and ClipC pre-extrapolation if they have them).

    That will keep ClipA values until ClipB changes them, and keep ClipB values until ClipC changes them.
     
  5. joebain

    joebain

    Joined:
    Oct 24, 2014
    Posts:
    47
    In the end I created two tracks, with ClipA and ClipC on the top, since they both affect the same part of the model, then ClipB on the bottom. That seems to work although it would be nice if the timeline behaved the same was as the animator in this respect. Unity_2019-09-10_09-31-09.png
     
  6. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    That works. Override tracks are effectively the same.

    This is actually the purpose of override tracks (and sometimes avatar masks). In your case, where the clips don't animate the same fields, this is effectively a way to overlap those clips without blending.

    The alternative is 'write defaults' which the animator controller has. We may add that - or something similar - but we need to make sure that scrubbing a timeline remains as deterministic as possible, and also performant, so that scrubbing always produces predictable results. Having one clip dependent on the results of the previous clip does complicate that.
     
  7. joebain

    joebain

    Joined:
    Oct 24, 2014
    Posts:
    47
    Sorry, what I mean is that in the timeline clips act like states that have "write defaults" ticked, but there is no way to disable that.

    Thanks for your help!