Search code examples
unity-game-enginenetwork-programmingunity3d-mirror

Jittery Ship Movement when clients are driving the ship (Unity Mirror Networked Game)


I’m hoping to get some advice on how to approach my ship movement in game.

I have a ship (not a rigidbody) that my players (rigidbodies) are childs of. Any player can drive the ship. When the host drives the ship, movement is perfect for host and clients. When a client drives the ship, the movement is fine for the player driving the ship, but the ship is jittery for the host and other players.

Currently, I have the players send information to the server, and the server moves the ship. What is the best way to move the ship? Would it be to have each client move the ship, and then the server just checks that the position is correct?

Cheers for any advice!


Solution

  • I worked out how to fix the jittery movement and am posting my answer here in case this ever comes up in a search.

    The jittery movement of the ship and other clients was actually due to the camera and not the RPC or ship movement. I had to put all camera movement in LateUpdate() instead of Update(). This fixed all the jittery movement for clients.

    For the ship movement, I have the client request movement, the server then moves the ship for all clients.