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

Issue with mixing Animator and Timeline animations

Discussion in 'Timeline' started by jasonbakker, May 2, 2017.

  1. jasonbakker

    jasonbakker

    Joined:
    Jan 13, 2015
    Posts:
    8
    First, thanks for creating Timeline, have been using it quite a bit on our game-in-progress and, particularly because of the design of our game, Timeline sequences are quickly becoming what we're basing our game around technically.

    After updating to 2017.1.0b1, I've run into an issue where Timeline animations will no longer smoothly blend in or out from what's currently going on in the Animator/Mecanim - instead they blend to/from their T-Pose if you have an easein or easeout time set, and even when a clip is fully blended out on the track (ie. there's no clip where the play head is) they'll be in the T-Pose. If you reduce the ease times to 0, they play their Mecanim animations correctly when there's no clip overriding it, but obviously snap from the Mecanim animations into the Timeline ones. Seems like potentially a bug in the Animation Mixer?

    I've tried playing around with the various types of Animation Extrapolation options, but none of them seem to fix the issue.

    (To make it extra clear I'm talking about the functionality showcased in the Unity 2016 talk here:
    at t27:46.)
     
  2. jasonbakker

    jasonbakker

    Joined:
    Jan 13, 2015
    Posts:
    8
    Oh, just an update on this - just realised that even when the ease times are 0 it doesn't properly play the StateMachine animations; it just blends to/from a different fixed pose.
     
  3. thierry_unity

    thierry_unity

    Joined:
    Jun 10, 2015
    Posts:
    187
    Hi,
    in 2017.1 lot of thing changed and b1 unfortunately was missing lots of bugfixes for Timeline.
    Can you tried with B2 or even B3 that just got out? It should solve the issue.

    thanks!
     
  4. David-J-Foster

    David-J-Foster

    Joined:
    Jan 13, 2014
    Posts:
    18
    I am using b5 and it is definitely the case for me that when a clip is absent on the animation track, or when easing is down, it does not play the underlying Mechanim animation (which is clearly evaluating based on state progress indicators), but instead sits at a fixed pose.

    Is this a bug or is there something wrong with my animations?
     
    ve03vsx likes this.
  5. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    Any chance you have Extrapolation set on the clips? That will hold/loop the pose (depending on the animation clip settings). They are set to on by default.

    The state machine-timeline blend will only happen in PlayMode, in Edit mode it should just blend from a bind pose.
     
    David-J-Foster likes this.
  6. David-J-Foster

    David-J-Foster

    Joined:
    Jan 13, 2014
    Posts:
    18
    Thanks seant_unity. I have set all of my extrapolation values to none. Still, any empty space on the track while in play mode results in a static pose. Any other ideas, settings to watch out for, etc.?
     
  7. jasonbakker

    jasonbakker

    Joined:
    Jan 13, 2015
    Posts:
    8
    Apologies for the delay in reply thierry_unity and seant_unity - I've also just upgraded to b5 and am still getting the issue, regardless of the extrapolation setting. I've attached screenshots of my Animation Playable Asset's settings and the Timeline in question, during play mode.
     

    Attached Files:

  8. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    Any chance you could post a bug with a repro project?
     
  9. David-J-Foster

    David-J-Foster

    Joined:
    Jan 13, 2014
    Posts:
    18
    Hi seant_unity. I should have some time to do this in the next couple of hours.
     
  10. David-J-Foster

    David-J-Foster

    Joined:
    Jan 13, 2014
    Posts:
    18
    seant_unity, I have submitted a bug report and repro project (from my @apache.co.uk account). If anyone's interested, you can download the repro and try it yourself here: https://we.tl/ki8bgidXRe
     
  11. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    Great thanks! I had a look at the project. You can make it work by turning on the 'Apply Root Motion' on the animator.

    Timeline has root motion on, and since Timeline and the Runtime Controller are blending, root motion is being applied during the gaps on timeline. Which is why the object stops.

    If the animation was animating children in it's hierarchy those would be applied, root motion or not.
     
  12. David-J-Foster

    David-J-Foster

    Joined:
    Jan 13, 2014
    Posts:
    18
    I heard back from Vidmantas Luneckas on the Unity QA team. His response:

    "This behaviour is intended. The animation track that manipulates the hierarchy (including the root) overrides the animations that are played by Animator. You can, however, parent the cube and animate the parent in the Animation track instead. This way everything will be played."

    I find this kind of an unsatisfying answer, especially given this is clearly not what's happening in the above-posted video. I have got back to Vidmantas linking the above video and asking some more questions. I will respond here if I learn anything more.
     
  13. David-J-Foster

    David-J-Foster

    Joined:
    Jan 13, 2014
    Posts:
    18
    Thanks Sean! Applying root motion works!

    That said, I'd rather not use root motion as I have found that when scrubbing in the timeline my objects regularly end up in unexpected places. Also, using easing results in animations with translation stopping short of their desired destination.

    Can I tell the timeline to not apply root motion? Alternatively would you kindly go into more detail about your third paragraph, which seems to suggest another way altogether to get around this?

    Forgive my ignorance! As you can see from my project, I am not an animator! I am evaluating the timeline from a tech/toolchain perspective. :¬)
     
  14. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    No, you can't tell timeline to not apply root motion, at least not today. You can toggle the flag in the animator, either from a script, or a custom playable, but applying root motion on your state machine part of the time could cause more problems.

    As for my third paragraph, I just meant that if there was an animated hierarchy on the object, only the root transform would not be updating. The rest of the object does animate regardless of the root motion flag.
     
  15. David-J-Foster

    David-J-Foster

    Joined:
    Jan 13, 2014
    Posts:
    18
    Hi Sean. So I tried what you mentioned re: hierarchy animation. I've found that the animation now doesn't work at all during track empty space, even when applying root motion. Would you mind taking a look at this project? https://we.tl/WKyZd5GlPl
     
  16. jasonbakker

    jasonbakker

    Joined:
    Jan 13, 2015
    Posts:
    8
    After mucking around for a while today I figured out some more information about why my Timeline animation clips don't blend properly with the Animation Controller animations, while the ThirdPersonController (Ethan) out of Standard Assets does - it seems to be because my model & animations' rig AnimationType is set to "Generic" instead of "Humanoid". Changing it to Humanoid fixes the issue, but we had it set to Generic because that was fixing some other unrelated issues for us.

    Based on my tests, you should be able to take any AnimationController hooked up to a model/anims that're set to Generic and reproduce the issue, but let me know if you'd still like a repro project submitted for this issue, and I'll try to find some time to do it later this week.

    Thanks for chasing this up!
     
    David-J-Foster likes this.
  17. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    Sorry for the delay replying. We are looking into it.
     
  18. jasonbakker

    jasonbakker

    Joined:
    Jan 13, 2015
    Posts:
    8
  19. Roy-Massaad1

    Roy-Massaad1

    Joined:
    Jun 30, 2015
    Posts:
    16
    Hello guys,

    any updates on this issue yet ?

    im also trying to test smooth blending between an generic-animated object's animator state and another animation clip for it for when the timeline starts but no blending seems to take place, it just snaps when timeline starts

    i did set extrapolation to none and tried to enable/disable root motion
     
  20. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    Try setting the ease-in value on your initial animation clip.
     
    Roy-Massaad1 likes this.
  21. Roy-Massaad1

    Roy-Massaad1

    Joined:
    Jun 30, 2015
    Posts:
    16
    love u man it works ! :)
     
  22. jschroyen

    jschroyen

    Joined:
    Aug 19, 2015
    Posts:
    22
    Still works 6 months later, works for ease-outs to blend back to the Animator too
     
  23. mgeorgedeveloper

    mgeorgedeveloper

    Joined:
    Jul 10, 2012
    Posts:
    322
    When both BLENDING clips and applying ROOT MOTION, there is a massive discrepancy between edit mode scrubbing/playing and actual Play mode. For example, when blending between an idle animation and a 180 rotation, in edit mode the full 180 rotation will complete, but in Play mode, only about 90 degrees of the rotation will complete, depending on how much you are blending between the clips. This means, it is basically impossible to design a complex cutscene in edit mode, because your character in play mode ends up in entirely the wrong places, walking in different directions and different distances. A complete nightmare that I am desperate to find a work-around for.
     
    ansjuan likes this.
  24. i3b

    i3b

    Joined:
    Nov 7, 2017
    Posts:
    1
    The problem is when mixing Animator controller and Timeline.
    If a model has an Animator Controller (even it is void), with apply root motion enabled, and Timeline, the result position using the Timeline preview and using the play mode is different. This, like mgeorgedeveloper saids, makes the Timeline preview useless.
    To replicate this bug, you can use the raw mocap asset: https://assetstore.unity.com/packages/3d/animations/raw-mocap-data-for-mecanim-5330
    If you create an Animator Controller (you don't need to use any animation in it), and Timeline with 3 loops of the animation WalkeFWD and assign them to the avatar, you can see that the preview end position is different than the end position in play mode. If you set the Controller in the Animator Component to none, then the end position is the same in both.
    This bug should be fixed in order to make Timeline usable with Animator Controller
     
    Last edited: Feb 8, 2018
    mgeorgedeveloper likes this.
  25. mgeorgedeveloper

    mgeorgedeveloper

    Joined:
    Jul 10, 2012
    Posts:
    322
    Correct - I eventually realised that the combination of having an Animator Controller and Timeline root motion was the problem, although blending of clips on timeline made the result far worse, at least in my particular case. I now simply set the animator controller to null during cutscenes, then restore it back as gameplay kicks in (via script).
     
  26. grossimatte

    grossimatte

    Joined:
    Mar 15, 2013
    Posts:
    43
    Having the same issue and setting the animator controller to null seems to solve it, but you lose every animator state you were at when triggering the timeline, meaning that we need much more code interaction that we like.

    I really hope they will solve this issue with the release of 2018.01.
     
  27. lisasims

    lisasims

    Joined:
    May 28, 2013
    Posts:
    21
    I suppose this is still a problem with 2018.1.5 :( Still having similar issues..
     
  28. OtakuD

    OtakuD

    Joined:
    Apr 24, 2014
    Posts:
    49
    Still having issues here in 2018.2, any workarounds yet?
     
  29. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,967
    also still having this in 2018.2 latest release. Can someone from unity respond on the issue? Last official response was august 2017.
     
  30. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    2018.3 will contain fixes for root motion and preview in timeline. Here's a quick summary of the changes coming:
    • Animation tracks will give you the option of where to start from, either a fixed position/rotation or to use the existing scene offset. No longer will the behaviour depend on whether an animation controller exists.
    • When using scene offset, timeline will preview from the scene location/rotation.
    • The animator root motion flag will determine how root motion gets applied in timeline. With it on, local scale and humanoid scale will apply to the root motion. (i.e scaling the character will scale their root motion).
    • Also, root motion will no longer need to be generated on clips explicitly, it can be determined from root transform animation.
    These changes will be in the first beta release for 2018.3, so please try it out and give us feedback.
     
    Tony707 likes this.
  31. DragonfiAR

    DragonfiAR

    Joined:
    Jun 7, 2017
    Posts:
    2
    I'm have a timeline with a track moving a creature and another track animating the creature walking. When hit I want to play the creature getting hit additively but the animation fails to play and the walking just continues. If I mute the track with animation clips of walking the hit works perfectly. Is it possible to have the 2 tracks playing on the timeline and blend the animation of the hit too? I can see the clip transitioning in the state machine but nothing is visible.

    Any help much appreciated as this is a blocker to my current project! :(

    EDIT

    I've had lot of trial and error. I've found that I can use a simple animation and set it to play when hit. Initially it was playing on start and looping. I altered some of the code to stop the auo play as found here:
    https://github.com/Unity-Technologies/SimpleAnimation/pulls

    and that resolved part of it. It was still repeating regardless of the settings so I added an option to set it on init and that seemed to resolve that. It now plays although at the end of the animation it doesn't end and return to the timeline animation. I believe this is due to it never triggering ondone event as it is always playing a state. I couldn't see a way to catch when the animation finished so due to short time I've used a timed invoke hack to call stop on the simple animation which then allows the timeline one to play again.

    Unfortunately, after all this I've found that when deploying to Oculus Gear VR on mobile many of the characters have warped meshes with lots of the points pulled to the centre of the mesh. Other creatures are fine and even some not animated by timeline are warped so not sure if this is timeline related or not. I've had to switch from 2018.2 to 2018.3 to get the simpleanimation fix to allow it to overlay. Any ideas what might be causing this or if anyone has had a better way of dealing with the original issue?
     
    Last edited: Dec 30, 2018
  32. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    802
    @David-J-Foster did you ever end up finding a solution to that "scrubbing results in unexpected places" issue? Still seeing this with 2018.3.5f1.

    "That said, I'd rather not use root motion as I have found that when scrubbing in the timeline my objects regularly end up in unexpected places. Also, using easing results in animations with translation stopping short of their desired destination."
     
  33. David-J-Foster

    David-J-Foster

    Joined:
    Jan 13, 2014
    Posts:
    18
    Unfortunately not! :¬(
     
  34. snoche

    snoche

    Joined:
    Feb 22, 2010
    Posts:
    82
    I am having problems with blending from timeline to animator, I set up the ease in and out and works for the begining and end of clip but I have a long sequence that we need to pause in the middle to wait for user input and we desactivate the playable director to return to the animator state but this don't blend the current pose to the animator one.

    Any ideas how we can blend from that pose to the animator pose?
     
  35. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    802
    @snoche depending on how deep you want to go - we experimented with creating Animator graphs from script that layer on top of the timeline graph instead of below and were thus able to fade in Animators above timeline pauses. It worked but we ended up with a different approach (not involving so much fading).
     
  36. snoche

    snoche

    Joined:
    Feb 22, 2010
    Posts:
    82
    That is an interesting idea to have the animators on top instead of below.

    I have already solve the blending but using a different approach, for my case, I need a cinematic intro and don't need real data from animator just the idle state. I have decided to use just timelines, and avoid the animator. I have made a new timeline with all the idles for my characters in a infinite loop playing simultaneously with the other timeline ( it needs to play first so the normal animation override this) and when I need to wait for user input I just fade my Intro animations using ease in and out and for my surprise and pleasure after fighting a couple of days with this it blends perfectly!
     
    TheSwanCollective and fherbst like this.
  37. ansjuan

    ansjuan

    Joined:
    May 15, 2018
    Posts:
    15
    I'm just posting here to express my dissapointment with the whole timeline tool... I have not been able to blend between animators and timelines properly despite tons of different approaches, it is incredibly buggy, sometimes you do the same thing on different timelines and sometimes it works and sometimes it just doesn't. I'll just check out some external alternatives, but I do not recommend anybody to use unity's timeline, it's the most anti-intuitive tool unity has by far, and it does not work properly at all.
     
    TheSwanCollective likes this.
  38. TheSwanCollective

    TheSwanCollective

    Joined:
    May 6, 2016
    Posts:
    26
    I feel the pain, main. I feel it.
     
  39. Chambers88

    Chambers88

    Joined:
    Feb 25, 2018
    Posts:
    6
    After years struggling with the interaction between animator and timeline, I found out that what works best in most of the cases for me is setting the RunTimeAnimatorController to null before any cutscene starts, and then assigning back the original controller once it ends, so there's no conflict between what your animator and your timeline are telling your character to do...

    Doesn't solve the issue of smooth transitioning between those moments, but can help other people that come across this thread with similar timeline + animator frustrations
     
    aoikiwi and RedHatJef like this.
  40. Fel27

    Fel27

    Joined:
    Apr 5, 2021
    Posts:
    1
    Hi Folks,

    I've been working with custom playables creating a dialogue track that enables a pause (stops the timeline) and then starts again with keyboard input. I find when i set the post-extrapolate of previous clip to None and pre-extrapolate of following clip to None, the system reverts to using the underlying animator between the clips. Then, when the timeline picks back up, and next clip starts, timeline regains control. Have to plan the transitions, but it does seem that there is a consistent passing of control between timeline and animator controller given the above.

    BTW... a resource i found very helpful is the A Terrible Kingdom project:
    https://github.com/UnityTechnologies/ATerribleKingdom
    Lots of great example and working code to examine.
    I found this invaluable to learning how to make custom playables.

    Cheers!
     
    shyamarama likes this.