Search Unity

Timeline disable root motion from animationclip and offset frustrations

Discussion in 'Timeline' started by Nieles_GH, Jun 30, 2017.

  1. Nieles_GH

    Nieles_GH

    Joined:
    Jun 26, 2017
    Posts:
    57
    A few things are now really bugging me in timeline and almost prevent me from using it.

    Scenario: I try to animate a character walking over a path, for this I have a walk clip that has motion offsets animated in the clip and a character with an animator.

    Frustrations:
    1) I need to make the gameobject that has the characters animator a child object of a new empty gameobject otherwise the character keeps animating on position (0,0,0). This destroys my whole character setup since I have to move all characters scripts to the new empty parent object and make references to the child to find the Animator. this goes against every bone in my body. Since it is much more impractical to setup.

    2) There is no way to disable the root motion from animation clip in timeline. So now the child object with the animator is moving forward away from the parent and I can't find a way to disable it. So I have to make a new clip without root motion especially for the timeline?

    Right now the timeline works very counter intuitive for me :(
     
    Last edited: Jun 30, 2017
  2. Nieles_GH

    Nieles_GH

    Joined:
    Jun 26, 2017
    Posts:
    57
    Found another 1:

    3) All objects referenced in the timeline need to be in the same scene. In my current setup I use a location in multiple levels all having their own intro and outro animations. My solution for this was add an additive scene to each level containing the extra objects needed for that levels animation. But for example the main character is always present in the default base scene. But now I'm losing the references and I will need to make sure all objects are in the same scene as the timelines director, again working against my most effiecient setup...
     
  3. AlienMe

    AlienMe

    Joined:
    Sep 16, 2014
    Posts:
    93
    The solution we found to 'cancel' the root motion was to add an extra animation track to override the child's position / rotation to 0,0,0.

    The problem we found is that Timeline seems to be very flimsy at the moment. Doing this worked fine in one of our cutscenes.. but when we tried to do it on a second one.. Timeline would not record the position curve.

    We tried right clicking on the transform, and 'Add Keyframe', but it would not take. We tried hitting the 'record' button on the track, and moving the object, and again, it would only record the change in rotation, and not in position.

    So, we ended up, copy/pasting the 'good' timeline that had the 'cancel root motion' animation track over and over.
     
    Last edited: Jul 1, 2017
  4. thelebaron

    thelebaron

    Joined:
    Jun 2, 2013
    Posts:
    857
    All three seem to be the same issues I ran into recently when testing this out. Documentation and case usage is pretty thin so I'm hoping there are workarounds but if not its kinda disappointing. It also seems a bit kludgy needing expose/resolve fields and what not to pass them to the graph.
     
  5. Nieles_GH

    Nieles_GH

    Joined:
    Jun 26, 2017
    Posts:
    57
    Yeah right now it only seems to work with a very specific way of setting up your objects/scene and assets. I talked with one of the developers at Unite and one of the developers did acknowledge this. And as he said: Unity should not force you to doing things a certain way. So hopefully they will make timeline a bit more flexible.
     
  6. thierry_unity

    thierry_unity

    Joined:
    Jun 10, 2015
    Posts:
    187
    Hi @Nieles_GH
    Would it be possible for you to provide us a small sample of what you are trying to do? That would be really helpful!

    1) Good news! in 2017.1.0f1 you are able to record root motion on an humanoid or generic character without using the Parent object workaround. Simply need to create another track with the same object where you record the RootmotionAnimation .gif

    2)You can disable the root motion on the animator component itself but I'm not sure if it's really what you want here. The sample I talked earlier would help us figure that one out.

    3) Unfortunately it's not a Timeline only issue, it is not possible to cross reference objects between scenes. The issue here is actually that Timeline is allowing you to do that in the first place. For example, If you try to cross reference a camera with a script, the field will never let you drop the object. nope.gif

    hope that helps a little.
     
  7. DGordon

    DGordon

    Joined:
    Dec 8, 2013
    Posts:
    649
    Hi,

    I'm also trying to disable root motion for an animation clip in the timeline. I am moving the character through a motion tween track that I built ... I do not want any x/y/z movement from the model's walk animation. Disabling "Apply Root Motion" on the animator does not stop this. How do I turn this off?
     
  8. jayanam_games

    jayanam_games

    Joined:
    Jul 9, 2013
    Posts:
    44
    Same for me, disable root motion has no effect on 1) After stoppnig the game my character is moved to "somewhere", the x or sometime y axis values are reset to 0.
     
  9. thierry_unity

    thierry_unity

    Joined:
    Jun 10, 2015
    Posts:
    187
    Unfortunately, right now it's not possible to do what you are asking using timeline. We are already thinking of ways how to solve this issue. The only way I can see you could make it work is to actually disable the root motion directly on the clip by masking it (if it's an humanoid it seem to be a little tricky). The problem with that is it will affect the source material you are using.
    I'll try to update this thread when we have other workarounds or ideas how to solve that issue.
     
  10. mgeorgedeveloper

    mgeorgedeveloper

    Joined:
    Jul 10, 2012
    Posts:
    324
    In Unity 2017.3, disabling root motion on the Animator has no effect at all, and root motion is still applied. There is a huge disconnect between what you see in-editor by scrubbing, and what then subsequently happens when you hit play mode. In one particular timeline setup, I have characters being offset by 1000s of meters in play mode, and I can find no way to correct this and to make it look like it does in edit mode.
     
    Last edited: Jan 18, 2018
    KevinCastejon likes this.
  11. Immu

    Immu

    Joined:
    Jun 18, 2013
    Posts:
    240
    mgeorgedeveoper -> getting the same problem here (2017.3.f3). Any ETA on that issue Thierry ?
     
  12. mgeorgedeveloper

    mgeorgedeveloper

    Joined:
    Jul 10, 2012
    Posts:
    324
    OK so it seems that as soon as any kind of root motion is used in Timeline, you get some random or otherwise incorrect initial positions for the animated object, but there are slightly different scenarios with different workarounds.

    One scenario was exactly this:

    https://issuetracker.unity3d.com/is...tent-result-between-the-preview-and-play-mode

    I fixed it by using Timeline to "animate" the parent of the actual animated object into the correct position, with the actual animated object starting at 0,0,0 within the parent.

    In another scenario, this "fix" doesn't work for me. In this case, the animated characters are within a moving dropship. Something here probably further confused Timeline. Here, the ONLY fix I could find was to use "Bake Into Pose" within the animation import settings, to essentially forcefully get rid of any root motion adjustments to the root bone. The characters within the dropship are now always at 0,0,0 within their respective dummy parent objects, and they stay at 0,0,0 during all blended animations.
     
  13. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,151
    Hello! How to get the character moving if theres no root motion in the animation?
     
  14. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    Timeline always applies root motion, so root transform animation won't apply unless you generate root motion on the animation clip. I expect this to change for 2018.3, and for all root transforms to be supported.
     
    zwcloud, wang37921 and mattis89 like this.
  15. danbfx

    danbfx

    Joined:
    Feb 22, 2011
    Posts:
    40
    Hi there,

    we just have a looped animation. Every time the timeline loops it adds an offset. The whole point was to replicate animation precisely. How could we achieve this?

    Thanks
     
  16. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    Is the offset on the track, timeline clip or animation clip?
     
  17. cb_short223

    cb_short223

    Joined:
    Mar 29, 2018
    Posts:
    3
    Same exact issue for me as danbfx. I have an animation clip of a walk cycle imported via fbx. I'm trying to have a walk cycle that snaps back to its start position and not walk away to infinity.
     
  18. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    If the issue is when the timeline is looping, then the only solution right now is detach the controller on the animator. 2018.3 has a change to make the initial offset be a track property, and it would let you achieve this independent of the controller.
     
    panta likes this.
  19. cb_short223

    cb_short223

    Joined:
    Mar 29, 2018
    Posts:
    3
    Thank you for your reply. I forgot to mention I am currently on v2017.31f1 and will update once our current project is finished. When I detach the controller, what is the procedure to animate it when in play mode? (noob question)
     
  20. Deleted User

    Deleted User

    Guest

    @danbfx did you manage to do that?
    @seant_unity I'm just moving a cube to left, then right and loop that. Running the animation as legacy works, the cube snaps back to the center and starts from there. Running the clip in timeline adds offset. I extended the playtime to 3 times the clip length and enabled the clips loop time. Apply Root Motion is disabled on the Animator and Loop Pose is disabled on the clip. I can also clearly see the gap in positions of the curves in the Timeline curve portion of the clip.
    How do I get a root GameObject that is animated to loop it's animation without offsets?

    [Unity 2019.1.0a12]
     
  21. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    You are right, looping the clip automatically loops the offsets. Simplest solution is to use multiple copies of the clip.
     
  22. Deleted User

    Deleted User

    Guest

    Is this behaviour intended, or does this happen out of the box due to Timeline being based on the same foundation as the animator is? the same happens when just using an Animator with just that animation and use root motion on it.
    Wouldn't it make sense to reflect the bool flag within timeline and make it toggleable on both ends?
     
  23. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    938
    I'm not sure what I'm doing wrong but I have character in my scene. I wanted to add animation and audio so I thought timeline would be perfect. I set that up all appears ok. I press play to test and the cutscene is taking place underneath the earth at position 0,0,0. Is there a way to play the cutscene at the location my NPC should be in the gameworld?
     
  24. Nieles_GH

    Nieles_GH

    Joined:
    Jun 26, 2017
    Posts:
    57
    Don't animate the position of the root object, instead animate the position of a child object. This way the root object of your NPC stays in the world and isn't touched by the animation.
     
    AndyNeoman likes this.
  25. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    If you are 2018.3 or higher, you can also set the animation track to Scene Offsets. It will start playing from where ever it is.
     
    ZeroFlame, AndyNeoman and Nieles_GH like this.
  26. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    938
    Thanks for the replies guys I will give them a try.
     
  27. luch85

    luch85

    Joined:
    Apr 7, 2019
    Posts:
    5
    Are there any updates on this issue? my fingers are crossed.
     
  28. luch85

    luch85

    Joined:
    Apr 7, 2019
    Posts:
    5
    I'm having a similar issue here: https://forum.unity.com/threads/root-motion-for-timeline-player-animation.667783/

    The character animations work great for me on the timeline when I don't have a Character Controller attached. So I'm thinking, is there a way to have two characters, one that acts out the timeline Cut Scenes and when it's done, that character is disabled and the playable character (with the character controller) is enabled in it's place?

    Would need to transfer the position of the character at the end of the sequence to the playable character, but it seems like a much better alternative to messing with root motion inside scripts.
     
  29. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    @luch85 Which issue in particular? 2018.3 address many root motion issues by introducing different offset modes. Scene offsets start the character from where ever it is when the timeline starts, for instance.
     
    mattis89 likes this.
  30. chubaski

    chubaski

    Joined:
    Nov 27, 2015
    Posts:
    3
    Hii guys and unity technology. Am having a timeline issue here. First when i animate a character in the scene and press the play button, the character disappears from the scene to another location(seems like the offset). How can i fix this

    Secondly, when i add the character in the timeline and add animation track, i add the animation clip that i want to us, but when i hit play the character does not play the animation or the timeline wont play the animation. What exactly is going on and how can i fix it

    Thirdly am having a yellow warning sign error in the console "You are recording with an initial rotation offset. This may result in a misrepresentation of euler angles. Whe recording transform properties,it is recommended to reset rotation prior to recording ". What??
     
  31. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    1) Which offsets are you using on the track? Track Offsets will place the character at a specific translation/rotation and that is the default. Scene offsets will keep the character where it is and start animating from there.

    2) This could be many things. Is the animator disabled or the gameObject inactive? What type of character and animation are you using (humanoid or generic)? Is the animation clip legacy? (Timeline typically doesn't allow that).

    3) Prior to using the recording feature, reset the rotation of the gameObject to 0,0,0. When recording translation or rotation, both the initial position and rotation is copied to offsets. This prevents the need to record both rotation and translation at each key, and makes the rotation curves more in line with what you are recording, since all translation and rotation keys are recorded relative to the initial offsets.
     
  32. meichen8050753

    meichen8050753

    Joined:
    Jan 16, 2017
    Posts:
    37
    If I use Scene offsets, Then I can't move the character anyway, eg: walk forward (change transform's position like transform tween track) with animation;
    If I use recording feature, Then I can't set the origin position anyway except the recorded one like I wan't play a timeline action width an enemy, the enemy can walk in sence with AI ;
    I solved this problem only the way to copy the animation and set to Root node option to None;
    I just want thimeline do not set the position when play the animation with set Root node, can anyway to solve this problem?
     
    Last edited: Jun 11, 2019
    d1favero likes this.
  33. shotoutgames

    shotoutgames

    Joined:
    Dec 29, 2013
    Posts:
    290
  34. meichen8050753

    meichen8050753

    Joined:
    Jan 16, 2017
    Posts:
    37
    what do you means Eww.....
     
  35. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    If the animations are writing the root node, then I don't think you can override it, even with an avatar mask. The animation track in Timeline will pick up on the animation having root animation and try to make appropriate corrections and always write.

    So, having your clips not write to the root is one way. Using OnAnimatorMove() in a monobehaviour and not applying motion should work as well.
     
  36. meichen8050753

    meichen8050753

    Joined:
    Jan 16, 2017
    Posts:
    37
    I fund a way to fix this, I custom the AnimationTrack and AnimationPlayableAsset and not AnimationOffsetPlayable and AnimationRemoveScalePlayable when CreatePlayable。Then it works well. But I want know why unity control position itself when animation use root motion, There have any reason ?
     
  37. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    The built-in animation track (including when root motion is applied) is meant to support deterministic position / rotation for all times when root motion is applied, which is an absolute requirement for cinematics, and in many cases accurate preview in editor.

    For gameplay systems, it may not be a requirement at all. Small changes introduced by frame rate, precision, timing, etc.. may not matter, and, if the root motion has multiple factors (e.g. physics), then you may be paying a cost you don't need.

    In that case a simpler/different/custom animation track is a good solution.
     
  38. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    If the track is in record mode, you can do that.

    Which issues did you have with animating the root motion? If you want root motion features like looping, then animating the parent will likely make that more frustrating. What are you trying to do? I made some suggestions here https://forum.unity.com/threads/cant-move-gameobject-after-timeline-completes.614059/ that might help your scenario.
     
  39. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    Instead of two tracks, try using an override track (in the context menu for the track). Effectively the same thing, but the two tracks are authored to be bound to a single target.

    As for the red on recording, that looks like a bug. It should initially be blue.
     
  40. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    Yes, timeline always evaluates top to bottom. And yes, that is opposite of convention in a lot of sequence editors :)

    If you use the playable graph visualizer package you can see the difference in what's generated. Using two track generates two animation graphs and two outputs - they are treated completely independent of each other, as if they came from separate timelines. Override tracks generate layers, similar to layers in an animation controller, and generates one graph and one output, which is marginally more efficient as well.
     
  41. SaroVati

    SaroVati

    Joined:
    Jun 7, 2015
    Posts:
    5
    Is there a fix for this? This is still the case in 2019.2.13f, and doesn't make much sense as to why it's handled this way. The workaround I have is literally to set the Animation Track mode to "Auto", which gives me a nice warning message of "this is deprecated". Kind of ridiculous that the proper functionality is provided in the deprecated option, and not possible in either of the 2 new offered solutions.
     
  42. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    @SaroVati

    The preferred fix is use animations that don't write to root transform, or have root motion.

    If timeline detects that there are modifications to root transform from a clip, then it either provides track offsets to let you place the clips at an explicit position/rotation in the scene, or Scene Offsets that will automatically use position/rotation based on the current position/rotation when the timeline starts.

    If you want to write an explicit value for the root transforms, you can use an override track and set it.

    The Auto feature is deprecated because the old behaviour made this choice based on values in the animator, instead of it being a choice in timeline itself, and the new ways are intended to be more explicit. It also follows changes in animation that changed how root transform modifications are handled. That being said, I don't see a need for us to remove it in the immediate future, it is providing the old functionality using the new functionality under the hood.

    Another alternative is to use AvatarMasks to mask off certain portions of the hierarchies. Unfortunately I don't think timeline considers the avatar mask when determining if it should provide offsets. Maybe that is the solution you are looking for?
     
  43. vgkonstantakopoulos

    vgkonstantakopoulos

    Joined:
    Apr 10, 2020
    Posts:
    1
    An easy fix for the rotation issue that worked for me was to double click on that timeline, which took me to its animation in the Animation tab and in Rotation options select Quaternion.
     
  44. jeffman1

    jeffman1

    Joined:
    Oct 21, 2013
    Posts:
    36
    I got rid of offsets in my animations by setting Root Transform position in the imported assets file directly if its a 3d model. I still have a problem with a model that is stuck in idle animation. I am using timeline as well as animator components and the model with a controller but no root motion applied works. The one using 3rd person standard asset scripts though is stuck in idle animation for a cutscene (except the mouth is moving properly) after the player hits an area to enable the camera with the timeline in script. Is their a way to apply the timeline animation to the character? Unity Version: 2019.3.15f1
     
  45. KevinCastejon

    KevinCastejon

    Joined:
    Aug 10, 2021
    Posts:
    98
    I'm running Unity 2023.2.11 and I'm still not able to deactivate root motion on Timeline animation clip.
    I cannot easily remove the incriminated curves from the clip because it's a .fbx and animation clips are read-only...
    Is there any news on this?