diff --git a/Assets/Mirror/Components/NetworkTransform/NetworkTransformHybrid2022.cs b/Assets/Mirror/Components/NetworkTransform/NetworkTransformHybrid2022.cs index 938ad01b8..bceaba455 100644 --- a/Assets/Mirror/Components/NetworkTransform/NetworkTransformHybrid2022.cs +++ b/Assets/Mirror/Components/NetworkTransform/NetworkTransformHybrid2022.cs @@ -342,6 +342,11 @@ void RpcServerToClientBaseline_PositionRotation(byte baselineTick, Vector3 posit // ignore if this object is owned by this client. if (IsClientWithAuthority) return; + // host mode: baseline Rpc is also sent through host's local connection and applied. + // applying host's baseline as last deserialized would overwrite the owner client's data and cause jitter. + // in other words: never apply the rpcs in host mode. + if (isServer) return; + // save last deserialized baseline tick number to compare deltas against lastDeserializedBaselineTick = baselineTick; lastDeserializedBaselinePosition = position; @@ -364,6 +369,11 @@ void RpcServerToClientBaseline_Position(byte baselineTick, Vector3 position) // ignore if this object is owned by this client. if (IsClientWithAuthority) return; + // host mode: baseline Rpc is also sent through host's local connection and applied. + // applying host's baseline as last deserialized would overwrite the owner client's data and cause jitter. + // in other words: never apply the rpcs in host mode. + if (isServer) return; + // save last deserialized baseline tick number to compare deltas against lastDeserializedBaselineTick = baselineTick; lastDeserializedBaselinePosition = position; @@ -385,6 +395,11 @@ void RpcServerToClientBaseline_Rotation(byte baselineTick, Quaternion rotation) // ignore if this object is owned by this client. if (IsClientWithAuthority) return; + // host mode: baseline Rpc is also sent through host's local connection and applied. + // applying host's baseline as last deserialized would overwrite the owner client's data and cause jitter. + // in other words: never apply the rpcs in host mode. + if (isServer) return; + // save last deserialized baseline tick number to compare deltas against lastDeserializedBaselineTick = baselineTick; lastDeserializedBaselineRotation = rotation; @@ -404,6 +419,11 @@ void RpcServerToClientDelta_PositionRotation(byte baselineTick, Vector3 position // ignore if this object is owned by this client. if (IsClientWithAuthority) return; + // host mode: baseline Rpc is also sent through host's local connection and applied. + // applying host's baseline as last deserialized would overwrite the owner client's data and cause jitter. + // in other words: never apply the rpcs in host mode. + if (isServer) return; + // debug draw: delta if (debugDraw) Debug.DrawLine(position, position + Vector3.up, Color.white, 10f); @@ -418,6 +438,11 @@ void RpcServerToClientDelta_Position(byte baselineTick, Vector3 position) // ignore if this object is owned by this client. if (IsClientWithAuthority) return; + // host mode: baseline Rpc is also sent through host's local connection and applied. + // applying host's baseline as last deserialized would overwrite the owner client's data and cause jitter. + // in other words: never apply the rpcs in host mode. + if (isServer) return; + // debug draw: delta if (debugDraw) Debug.DrawLine(position, position + Vector3.up, Color.white, 10f); @@ -432,6 +457,11 @@ void RpcServerToClientDelta_Rotation(byte baselineTick, Quaternion rotation) // ignore if this object is owned by this client. if (IsClientWithAuthority) return; + // host mode: baseline Rpc is also sent through host's local connection and applied. + // applying host's baseline as last deserialized would overwrite the owner client's data and cause jitter. + // in other words: never apply the rpcs in host mode. + if (isServer) return; + OnServerToClientDeltaSync(baselineTick, Vector3.zero, rotation);//, scale); }