0
\$\begingroup\$

I have CharacterControllers as players in my multiplayer scene, and they got NetworkTransforms attached, with

  • Sync Mode = Sync Character Controller.

When I stop running with my character, my character stops on the other players' screens as well.

I've got MonoBehaviours attached to them, where I control the character's animations based on characterController.velocity.

The problem is this:

The animations won't stop because characterController.velocity is the same as it was when I was running.

This only occurs on non-local characters, because the local player got Local Player Authority checked, so its controller isn't synced from the server but to the server.

Why and how could I fix this? Thanks in advance!

\$\endgroup\$
  • \$\begingroup\$ did you try to send characterController.velocity ? \$\endgroup\$ – Seyed Morteza Kamali Feb 13 at 17:08
  • \$\begingroup\$ Yeah, I could do that, but that's just a workaround, not really an explanation or correct solution :\ \$\endgroup\$ – Tudvari Feb 14 at 9:37
  • \$\begingroup\$ can you update your question and add your scripts and insert gif or video that show the problem. \$\endgroup\$ – Seyed Morteza Kamali Feb 14 at 14:05
  • \$\begingroup\$ can you upload a sample I need it for testing purposes \$\endgroup\$ – Seyed Morteza Kamali Feb 14 at 15:48
  • \$\begingroup\$ Just create a character controller, sync them across the network, log their velocity and see that even if they aren't moving anymore, their velocity stays as it was during moving. \$\endgroup\$ – Tudvari Feb 15 at 13:46
0
\$\begingroup\$

I think this is an issue originating from Unity's network code, so after a few failed tries, I just fixed it by calculating the velocity locally.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.