Search Unity

Character with Animation: back to the original position in Timeline preview

Discussion in 'Timeline' started by johnny1225, Mar 17, 2017.

  1. johnny1225

    johnny1225

    Joined:
    Oct 27, 2016
    Posts:
    3
    I put a character A in timeline as a animation track. Then dragged 2 animations: running, sprinting forward roll in A's track. I wanted A to running at the begin of this track and then roll forward. And it worked when I click the Unity "Play" button.

    But when I tried to replay it in Timeline Editor at specific time, things changed. Character A went back to the original position after "running" animation clip finished, then rolled from that position, which was totally different from what I saw in the "Play" mode.

    upload_2017-3-17_12-3-39.png

    upload_2017-3-17_12-4-6.png

    upload_2017-3-17_12-4-35.png
     
  2. Selzier

    Selzier

    Joined:
    Sep 23, 2014
    Posts:
    652
    I'm also having a problem with the Timeline Editor and character's position. If I have a character in my world, who has an Animation Track, when I click on the animation track in the Timeline Editor, the character is moved to world position 0,0,0.

    So I want my character to start on top of a hill, but when I click on the Timeline Editor, or when I press Play in Unity, the character is immediately moved to 0,0,0 (underneath of the hill mesh).
     
  3. Selzier

    Selzier

    Joined:
    Sep 23, 2014
    Posts:
    652
    Here's the problem explained, am I doing something wrong?

     
  4. julienb

    julienb

    Unity Technologies

    Joined:
    Sep 9, 2016
    Posts:
    177
    In order to edit the initial position of an object bound to an Animation Track, you can use the track's offset. Click on the animation track in the timeline, activate the Apply Track Offset checkbox, then edit the position/rotation to match your desire.
    677fd3b6b7bcc9c8aefb47b3b289a3f9.png
     
    Jykob, sikkiv, jipsen and 2 others like this.
  5. Selzier

    Selzier

    Joined:
    Sep 23, 2014
    Posts:
    652
    That fixed it for me, thanks. However I do still have the same problem that original poster has reported.
     
    Last edited: Mar 23, 2017
  6. zyeurgh

    zyeurgh

    Joined:
    Nov 2, 2012
    Posts:
    6
    Hi,

    I ran into a similar issue when trying to play two root motion animations sequentially on a character.
    Specifying the offset works for the first animation but then the second animation will start from whatever offset is specified for that second clip (as the motion of the first clip is not remembered or applied?).
    We would then need to specify another offset for the second clip or any following clips, which seems error prone and would become wrong if, let say, the first animation changes slightly.

    Is that what that chehckbox "Äpply Track Offsets" is there for? It doesn't seem to be present in the currently available build (5.6.0b6).

    Cheers,
     
    SamRock likes this.
  7. zyeurgh

    zyeurgh

    Joined:
    Nov 2, 2012
    Posts:
    6
    Actually, the "Äpply Track Offsets" is there on the track inspector, I was looking at the clip level.
    I see it applies the offset for all the clips, which is nice but it still requires to have a local offset for each sequential clips to align them after the previous one.
     
  8. zyeurgh

    zyeurgh

    Joined:
    Nov 2, 2012
    Posts:
    6
    Alright, it looks like the way to handle this is to right click on the animation clip and hit "Match Offsets to previous clip".
     
    Marrlie, jonatiti48, SamRock and 4 others like this.
  9. jayanam_games

    jayanam_games

    Joined:
    Jul 9, 2013
    Posts:
    44
    Same problem here:

    Add a character with an animation to the timeline, but the animation does not move the character. So I try to record a move animation in the time line for this character like so:

    1. Move to first frame and press record.
    2. Move the character just a few pixel to get the keyframe -> ok
    3. Move to another frame and move the character to new posistion still recording
    4. Deactivate recording

    When I move now the time slider in the editor, the charcter's movement is not reflected in preview.

    When I press save the character is moved *somewhere* in the scene
    When I then use the timeslider the animation is played backwards (Character starts from end and moves to beginning)

    Feels very buggy this thing.
     
    kev_pearman likes this.
  10. elettrozero

    elettrozero

    Joined:
    Jun 19, 2016
    Posts:
    216
    Is it possibile that after all this time I still have the same issue??
     
    Last edited: Jul 14, 2017
  11. jayanam_games

    jayanam_games

    Joined:
    Jul 9, 2013
    Posts:
    44
    Yeah same here, so annoying
     
  12. Roy-Massaad1

    Roy-Massaad1

    Joined:
    Jun 30, 2015
    Posts:
    16
    how can we access and change the track offset vector variable of a certain playbable director/timeline/track by code from a c# script?
     
  13. julienb

    julienb

    Unity Technologies

    Joined:
    Sep 9, 2016
    Posts:
    177
    From a TimelineAsset, you can get a list of all the tracks by calling TimelineAsset.GetRootTracks. Then, on your AnimationTrack (you will have to cast TrackAsset as an AnimationTrack), you can set the AnimationTrack.position and AnimationTrack.rotation values.
     
    Roy-Massaad1 likes this.
  14. eladleb4

    eladleb4

    Joined:
    Apr 25, 2016
    Posts:
    57
    I saw and used this workaround from another thread:

    "The only workaround I can give you right now is to have a parent gameobject that would be used to record the position and keep the Humanoid object for animation clips."

    I think it's a reasonable workaround as I found working with the offsets confusing and error prone.
     
    ericjacobus likes this.
  15. walidabazo

    walidabazo

    Joined:
    Jul 8, 2017
    Posts:
    17
    Show this video very easy to Character Animation with Mixamo

     
  16. SamRock

    SamRock

    Joined:
    Sep 5, 2017
    Posts:
    250
    You are a life saver! Sad to see that even Unity employees didnt suggest this! Now my Characters smooth transition from one clip to another at the position it ended!
     
  17. soompanda

    soompanda

    Joined:
    Nov 23, 2018
    Posts:
    1
    Thanks
     
  18. roja_ch

    roja_ch

    Joined:
    Sep 10, 2019
    Posts:
    1
    I Couldnt find Apply Track Offset checkbox in the Animation Track
    upload_2019-9-12_2-7-42.png

    and i am using Unity 2019.1.0f2 Personal
     
  19. Onsterion

    Onsterion

    Joined:
    Feb 21, 2014
    Posts:
    215
    Same problem here i can't find the Clip Transform offset for disable it.

     
    SamRock likes this.
  20. Jykob

    Jykob

    Joined:
    Sep 16, 2019
    Posts:
    4
    This helped me man, thank you!
     
  21. XenoGaming

    XenoGaming

    Joined:
    Jan 20, 2016
    Posts:
    2
    I've found a solution for those who don't have the checkbox. Right click on the left line. Then "Track Offset" > "Auto" (but deprecated) unityTransformOffset.png
     
    RoaringHeart and Pawciu like this.
  22. Pawciu

    Pawciu

    Joined:
    Jun 21, 2015
    Posts:
    16
    Thanks, this one fixed it
     
    RoaringHeart likes this.