How to keep position and enable Aniamtor when timeline finished?

HI, I have some NPCs in my scene, when player enter a specific zone it’s triggered to play a timeline that the NPCs move into camera and start a battle.

The NPCs have their own animator, include states such as IDLE/RUN/ATTACK.
I want they stay at their position when timeline finished and turn into their own animator logic. When I use the wrap mode “Hold” it’s stopped.But if I chose “None” wrap mode, it’s go back to their position before timeline played.(I have to force set transform.position via script after timeline finished, it’s so ugly…)

So, is there an elegant way to solve this problem? Thank you very much.

When root motions are setup correctly on your animations (and enabled on the animator) this should ‘just work’. Which version of Unity is this, and are you using Humanoid or Generic?

We’ve also seen a few issues lately when ‘optimize game objects’ is on. If you are using that disabling that is worth a try

Thanks for your replay.
My unity version is 2018.2.10f1, and I’m using Humanoid.
My situation like below:

4107838--359971--GIF.gif
The npc has his own logic, animtor states is IDLE.
When I enable the timeline(Play On Awake checked), it start to play. But it’s blocked at the end of the frame of timeline when timeline finished, when I disable the timeline GameObject, the npc return back to it’s start position…

My question is how to let the npc stay at the end of the timeline’s position, and switch state to it’s animator?

The timeline is simply set as below:
4107838--359974--upload_2019-1-16_15-53-58.png
4107838--359983--upload_2019-1-16_15-59-7.png

4107838--359977--upload_2019-1-16_15-54-25.png

and the root motion of animation set as below:
4107838--359980--upload_2019-1-16_15-55-12.png

Is the apply root motion flag enabled on the animator? That would be the most obvious cause, although the fact that the average velocity on BigSword_Run1 is 0 is also suspicious.

You also have two animation tracks - Is the second to change the root position?

Thank you very much, the key is “root motion flag”. When it is enable, the problem solved.
emmm, it’s a little confused, because there would be more than one animation track of a GameObject in a timeline, some is to play character’s action, some to play character’s position changing. I only want the position changing Track “apply root motion”…

The second track was the hint that you didn’t have root motion setup. In general, it’s preferable to have the animation define the motion of the root transform, but it’s useful to override it with a second track when that doesn’t give the exact results you’d want.

Instead of using two separate tracks, you can add an override layer to the first track as well. It’s pretty much the same, but you only need to define the binding once.

1 Like

Thank you very much!
Your reply slove all my questions.

Hey not sure if you need this anymore. But I just found that you can right click on the Clip and Select -“Match Offset to Previous Clip”. This ensure that your character starts at the same position as the previous clip positon

some options shown don’t exists as I’ve seen in the latest version, what do i do?