Hello, I am trying to sync the rotation of the player in a first person rigidbody controller over network using client-side prediction. The first person camera I am using is only spawned on the client who owns the player.
I am using FishNet 3.10.8R, with the version 1 CSP system.
An issue I ran into was that collecting the mouse:delta Vector2 for y-axis rotation in the TickManager.OnTick() callback led to rotation that was not smooth. A solution I found was to sum the mouse:delta vectors in the update method of the client who owns the player I am trying to rotate, and then sending a single Vector2 containing the sum of those mouse:delta vectors over the network in my IReplicateData in the [Replicate] method. However, when doing this, the client's rotation is no longer synced over network.
Here is the update method on the camera controller which sums the net mouse:delta:
{
if (_playerInputManager != null)
{
Vector2 mouseDelta = _playerInputManager.GetMouseDelta();
if (mouseDelta != Vector2.zero)
{
_netMouseMovement += mouseDelta * Time.deltaTime * _playerInputManager.GetMouseSensitivity();
}
}
}```
And here is how I am gathering the inputs:
``` private void GatherInputs(out MoveData data)
{
data = default;
Vector2 strafeDirection = _playerInputManager.GetStrafeDirection();
bool isJumping = _playerInputManager.IsJumping();
var netMouseMovement = _firstPersonCameraController.GetNetMouseMovement();
_firstPersonCameraController.ResetNetMouseMovement();
if ((strafeDirection == Vector2.zero) && (isJumping == false) && (netMouseMovement == Vector2.zero))
{
return;
}
data = new MoveData()
{
IsJumping = isJumping,
StrafeDirection = strafeDirection,
NetMouseMovement = netMouseMovement,
};
}```