Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We've updated our Terms of Service. Please read our blog post from Unity CTO and Co-Founder Joachim Ante here
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    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:
    5
    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:
    5
    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

    Unity Technologies

    Joined:
    Jun 10, 2015
    Posts:
    161
    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:
    17
    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?
     
  5. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    644
    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:
    17
    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:
    5
    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:
    644
    Any chance you could post a bug with a repro project?
     
  9. David-J-Foster

    David-J-Foster

    Joined:
    Jan 13, 2014
    Posts:
    17
    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:
    17
    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:
    644
    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:
    17
    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:
    17
    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:
    644
    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:
    17
    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:
    5
    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:
    644
    Sorry for the delay replying. We are looking into it.
     
  18. jasonbakker

    jasonbakker

    Joined:
    Jan 13, 2015
    Posts:
    5
  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:
    644
    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:
    21
    Still works 6 months later, works for ease-outs to blend back to the Animator too
     
  23. mgeorgedeveloper

    mgeorgedeveloper

    Joined:
    Jul 10, 2012
    Posts:
    51
    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.
     
  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:
    51
    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. GonzoGan

    GonzoGan

    Joined:
    Mar 15, 2013
    Posts:
    38
    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. neosurreal

    neosurreal

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

    OtakuD

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

    GameDevCouple_I

    Joined:
    Oct 5, 2013
    Posts:
    1,126
    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:
    644
    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:
    1
    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