Issue with Position Syncing after playing animation through Animancer

Hello. I’ve been integrating coherence into my single-player RPG, and I’ve run into an issue where entity positions stop syncing right after playing an animation via Animancer. Attached below is a quick clip of the issue.

Has this bug come up before with coherence and animation? I’ve spent a good few hours trying to figure out why it’s happening, but haven’t gotten anywhere.

We may need some code snippets to understand what’s going on here. My best guess, though, is that the animation playing on the client is overriding the position of the game object, and so your synced coherence position updates are getting overwritten.

Could you perhaps provide a movie of the client’s component and perhaps some code snippets?

Yes, it’s probably the case. Are you aware of the concept of Root Motion?
Some animation clip contain Root Motion data, it means that they want to move the whole object. If there’s only one position key, you might see your character not move anymore after the clip is done.

So either turn off Root Motion on your Animator (my suggestion), or remove Root Motion data from the clip you play.


Btw, it’s very possible that it’s not coherence that is picking up the wrong position, but you had the issue also before, and you didn’t realise. If the Animation position is applied before your character controller, you might be able to move anyway because your character controller overwrites the animation position given by the Root Motion. Do you move the character in FixedUpdate?

When coherence is added, it just takes the position from the Animator before you override it. So it’s like:

Animator (Root Motion) → coherence sampling → Your script

What I’m saying is that, even if you decide to remove coherence, you should look into this issue because otherwise it might hit you later on, or when you release the game!

I responded on Discord earlier today, but wanted to thank both of you again. The issue stemmed from a mix of root motion and my own scripts overriding the position of the character.

I fixed those issues earlier today, and everything else I’ve worked on has been smooth sailing!

I’ll be sure to post any other questions / problems I encounter.

2 Likes

Great to hear! This is looking fantastic! Keep us updated on your progress

Nice, and thanks for posting the video: the project looks great!!

(which toon shader are you using, by the way? did you make it yourself?)

Thanks! I’ve been working on this with two friends for a bit over a month now so it’s still a bit raw :sweat_smile: but I’ll keep posting updates!

As for the toon shader, I’m using a tweaked RealToon on URP

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.