Hi guys, I have a quick question. I have been creating a multiplayer fps game and now I am working on player movement script. I encountered a problem. The problem is client move faster. But host move normally. Here is my player movement code.
[SerializeField] float movementSpeed = 0.03f;
[SerializeField] Vector3 movement;
#region Server
[Command]
private void CmdMove(Vector3 movement)
{
transform.position += movement * movementSpeed;
}
#endregion
#region Client
[ClientCallback]
private void Update()
{
if (!hasAuthority) { return; }
if (!Input.anyKey) { return; }
Movement();
}
private void Movement()
{
float xAxis = Input.GetAxis("Horizontal");
float zAxis = Input.GetAxis("Vertical");
movement = new Vector3(xAxis, 0, zAxis);
CmdMove(movement.normalized);
}
#endregion