Search Unity

Timeline ease out places object to point of origin

Discussion in 'Timeline' started by pbritton, Nov 19, 2019.

  1. pbritton

    pbritton

    Joined:
    Nov 14, 2016
    Posts:
    160
    I am running to this problem and I have no idea how to solve it. I am able to get the animation to start with the current offset but if I try to blend in or out the subject blends to the point of origin. If I disable timeline, it would snap to the point of origin. Currently the Animator is set with root motion disabled. If I enable it and run Timeline with a blend the subject moves blends up.

     
  2. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    When timeline isn't running (without root motion), how are you controlling the characters transform?
     
  3. pbritton

    pbritton

    Joined:
    Nov 14, 2016
    Posts:
    160
    With nothing. Because I was running into this problem in game, I decided to test Timeline with just the rig with no additional scripts or components to isolate the problem.
     
  4. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    Then timeline is blending to what the animator considers to be the current defaults (origin?), which appears to be below the ground. With root motion on, it's hard to tell, but it looks like it is blending the offsets of the timeline, then writing them as defaults (causing an accumulation) - are the animation track offsets above 0?

    If there is an animator controller running, then it should be blending back to what ever the animator controller is doing.

    If you need to blend back to a specific point/pose then run a timeline, controller, playable graph before the timeline that puts the character in the appropriate place so timeline has something to blend with.
     
  5. pbritton

    pbritton

    Joined:
    Nov 14, 2016
    Posts:
    160
    I am a bit confused by the what you are saying especially the last paragraph. In the clip above, I am running Animator which is evaluating a looping idle animation. I then play the Timeline. The animation plays with Scene offset so, the animation executes in the correct position. If I disable the Timeline gameobject it snaps to the origin. If I blend it also blends to the origin. What I would like, is for it to blend or revert to the original position prior to Timeline.

    Your recommendation of running Timeline, controller, playable graph before the timeline puts the character in the appropriate place reads a bit alien to me. :(

    I hope I am making sense.
     
  6. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    Ok, so there is a state machine running. Does your current state have write defaults enabled? Does your state machine modify the root transform (assuming Apply Root Motion is disabled)?

    My suggestion was to try it with a state machine running, because I took 'With Nothing' to mean there wasn't one.
     
  7. pbritton

    pbritton

    Joined:
    Nov 14, 2016
    Posts:
    160
    Does your current state have write defaults enabled?Yes

    Does your state machine modify the root transform (assuming Apply Root Motion is disabled)?No

    Current state machine is just and Idle animation that doesn't move the character.

    I just tried a clean scene with an Idle and Stand up animation. The Idle is the only clip in the state machine that is looping. The Stand Up is in the Timeline. With non root on the Animation Controller, the Timeline plays as expected but when I Ease out, it moves to the point of origin then snaps to the original Idle animation position.

     
  8. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    Ok, timeline is writing root transform, and it is blending to the default value (origin).

    Not sure if it's actually a bug, or if it's the setup of the animation clips that's the problem. You may need to set your animation clips to use root motion to get it to work correctly.

    It appears as if timeline is writing root transforms while it's blending, but the state machine is not, so timeline is either blending to 0 (without root motion) or to the previously written value (with root motion).
     
  9. pbritton_unity

    pbritton_unity

    Joined:
    Aug 3, 2018
    Posts:
    3
    Can this be overwritten in someway? Either by script or setting? I don't mind doing some additional work behind the scenes to get it to behave the way I want.
     
  10. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    Possibly by writing the desired root transform in an Update() method and/or calling Animator.WriteDefaultValues().
     
  11. pbritton_unity

    pbritton_unity

    Joined:
    Aug 3, 2018
    Posts:
    3
    I have some headway into this issue. I used what you suggested earlier and the results seems to be consistent at least in the small examples that I have used. I have tried the following with reliable results.

    • Two Mixamo animations. One Idle and the other the Stand Up
    • Track Offset = Apply Scene Offsets
    • Prior to running Timeline, the Animator Controller is to root.
    • When Timeline is complete, Animator Controller is set back non root
    This has prevented the animation from snapping even with Ease In and out. I will try with the in game scenario to see if this resolves the problem.
     
    seant_unity likes this.
  12. pbritton

    pbritton

    Joined:
    Nov 14, 2016
    Posts:
    160
    Well, this failed. It works when enable and disabling the root motion in the inspector but once its done via script it snaps the player to the position of the Timeline gamebobject and I can no longer move the player unless I enable and disable root motion in the inspector.:(

    This is what the inspector looks like upon disabling root motion via script.
    https://drive.google.com/file/d/1vibTlYDKWCQ2w-hmWacn-bwomsulJi9j/view?usp=sharing
     
    Last edited: Nov 20, 2019
  13. pbritton

    pbritton

    Joined:
    Nov 14, 2016
    Posts:
    160
    It seems like this problem was supposed to be resolved in 2019.3 which is what I am using.
     
  14. pbritton

    pbritton

    Joined:
    Nov 14, 2016
    Posts:
    160
    I have updated to 2019.3.0b11. This resolved the problem when disabling root animation via script. Yay!:D
     
  15. pbritton

    pbritton

    Joined:
    Nov 14, 2016
    Posts:
    160
    I am not sure what to do anymore. I am trying everything that I can think of to resolve this problem reliably but the results are not consistent. I am not even sure of the logic behind the issue. Is there a reliable way to prevent Timeline from snapping the player to point of origin or some random location upon completing and ending of Timeline? The following videos shows the issue.


     
  16. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    To make sure I understand - the timeline is writing root transform values, but your animator controller is not, correct?

    How are you controlling the root transform of your player character outside of timeline?
     
  17. pbritton

    pbritton

    Joined:
    Nov 14, 2016
    Posts:
    160
    Hi Seant, I am controlling the character with a script and the animation is non root when moving. When, I am using Timeline for switches and other interactible things, I switch to root and at the end of timeline switch back to non root using signals. This works inconsistently and I believe I maybe doing it wrong.
     
  18. pbritton

    pbritton

    Joined:
    Nov 14, 2016
    Posts:
    160
    Is there a way to set the root position that Timeline is using for Ease Out? This most likely would solve my problem after doing numerous tests. Because, if I can do that, I can override the root position Timeline trying to Ease Out to prior to the Ease Out.
     
  19. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    I think what you are looking for is Animator.WriteDefaultValues(). That sets the current values as the default values for the animator, but I believe it does it for the entire hierarchy.
     
  20. pbritton

    pbritton

    Joined:
    Nov 14, 2016
    Posts:
    160
    Thank you for the information Seant. The current solution that I am using is creating a custom signal that stops Timeline, and enables root motion. It has been working so. I will consider using Animator.WriteDefaultValues() if this triggers a failure in the future.
     
  21. Johnx140

    Johnx140

    Joined:
    Nov 10, 2015
    Posts:
    1
    Have you tried going into the Timeline Editor, clicking the animation, and then clicking on ''Remove Start Offset''? Works for me :D