Hi,
At this time I’ve coded the network like this :
The client send input to the server when things change, with an RPC.
The server send this data to all clients.
The clients lerp their position and rotation to the server position and rotation like this :
if(Network.isClient){
transform.position = Vector3.Lerp(transform.position, serverPos, Time.deltaTime * 5.0);
transform.rotation = Quaternion.Lerp(transform.rotation, serverRot, Time.deltaTime * 5.0);
}
So even if their is no accuracy between client and server physics it’s fixed immediatly.
It works fine but their is lag. I test it with the server and client on the same computer.
When I violently move the mouse, the player’s camera move to the desired rotation but move back a bit (due to the lerp).
The problem is that I must lerp things because of collision, but there is those laggy and unaccurate mouse movements.
Any advice about networking all this correctly ?
Thanks.