#Player Sync Position Is Lagging and Teleport (using NetworkTransform).

3 messages · Page 1 of 1 (latest)

worthy star
#

I have a player and a rock.

  • If I sync player positions from client to server, the client will not be able to move to rock.

  • If I sync player position from server to client, use the command to make the player move on the server, the client will be able to move the rock, but it's lagging.

I have read many forums and can't wrap my head around how to achieve this. It's not a problem to sync other systems in gameplay like save, load, spawn, scene, state, etc., but the lagging movement and physics are huge problems to me.

#

I'll try doing this:

  • Remove the NetworkTransform.
  • a sync variable named PlayerPosition that stores the player position (SyncVar).
  • If the client wants to move, it will call the Move command on the server. The server will change player positions using rigidbody. Then sync PlayerPosition.
  • The client will lerp the local player instance to PlayerPosition.
granite abyss