#Players Spawning in Wrong Position

2 messages · Page 1 of 1 (latest)

dull fern
#

I've been trying to create a multiplayer implementation for my project using the Simple Networking template as a guide but I've run into an issue. When a client connects to the host, their character is placed in the same position as the host's character, even if the host has moved away from the spawn point, but only on the clients side. On the host side I see the correct behavior with the client's character being spawned at the origin (I tested this by disabling position and rotation sync on the character's multiplayer synchronizer, leaving only the spawn sync). If I turn position sync back on, the hosts view of the client also changes so that the client's character is on top of the host's (as is expected, since the client has authority over their own character and they think that their character is at the same position as the host). This results in both characters rocketing into the sky as the physics engine and the MultiplayerSynchronizer fight over the two colliding bodies.

I've been scouring my code for hours now trying to figure out why the client always spawns on top of the host. At this point even a hacky workaround would be acceptable if it means I don't have to scrap my project and start over.

I've attached my project files

dull fern
#

Oof, well that's embarrassing. I just had an epiphany that maybe the client spawning in the wrong place had something to do with the moving platform behavior of CharacterBody3D, and I was right! I edited the physics layers so that the player's don't collide with each other and it fixed the issue, however, I still have a problem with the character spawning. If I try to set the position of the client's character, it still corrects back the origin after a frame. I think this might be more of a feature I haven't implemented than a bug in my code though, so is there a specific way I should go about fixing this?