As shown in the youtube video, whenever the time of an AnimationClipPlayable is changed, the root motion will be calculated according to the time difference.
My problem: Is there anyway to just change the time of an AnimationClipPlayable without root motion calculated?
For example, I want to reset the run animation, but I don’t want to rewind the position of the character.
But I found another problem.
If I set the time of the AnimationClipPlayable like this, I will not want the PlayableGraph to play automatically as the graph will be evaluated with deltaTime of Time.deltaTime so that the time of the AnimationClipPlayable will be increased by Time.deltaTime.
One thing I’ve noticed is that you can set a clip’s weight to zero, and then change its time, and since it has a contribution of zero to the root motion, it’s safe to change time. It’s only when your clip is weighted up that setting its time will affect the root motion delta.
Unfortunately, this means that you can’t jump around in an animation without getting a pop. Definitely irritating. The only way to jump continuously between animation points would be to have another AnimationClipPlayable instance… change its time, then weight it in, and weight out the old one. Hacky but should work.
I found that instead of setting a time twice to the same value, you want to set twice, but once with the relative previous time to what you want to set it to.
In other words, when you set the time, fool the clip into thinking it had been at that position the whole time. Don’t let it know that it’s time travelling, or it will take that time travel into account when calculating root motion.
So. Root motion seems to work by comparing the previous time of the clip to the current time of the clip, and using that to figure out the change in root motion position.
By setting it to the same thing, you are essentially saying NewRootPos - OldRootPos = Zero
By putting the head temporarily where it would have been last frame vs. your new time, you give it the ability to say NewRootPos - FakeOldPos = Non mad root change.
This won’t be a catch all solution. In some nodes I set clip time every time in order to have synchronized animation playbacks. In those cases I have to be careful about what my “fake last time” is vis a vis my arbitrarily changing playback rate.