From 0fd342e6a99824e59d3318d99cf26748ce3b3fd0 Mon Sep 17 00:00:00 2001 From: mischa Date: Wed, 10 Jan 2024 15:39:53 +0100 Subject: [PATCH] Prediction: CompareState renamed to OnReceivedState --- .../PredictedRigidbody/PredictedRigidbody.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Assets/Mirror/Components/PredictedRigidbody/PredictedRigidbody.cs b/Assets/Mirror/Components/PredictedRigidbody/PredictedRigidbody.cs index 2ee1fad51..e3cedba7b 100644 --- a/Assets/Mirror/Components/PredictedRigidbody/PredictedRigidbody.cs +++ b/Assets/Mirror/Components/PredictedRigidbody/PredictedRigidbody.cs @@ -303,9 +303,9 @@ void ApplyState(Vector3 position, Quaternion rotation, Vector3 velocity) rb.velocity = velocity; } - // compare client state with server state at timestamp. - // apply correction if necessary. - void CompareState(double timestamp, RigidbodyState state) + // process a received server state. + // compares it against our history and applies corrections if needed. + void OnReceivedState(double timestamp, RigidbodyState state) { // OPTIONAL performance optimization when comparing idle objects. // even idle objects will have a history of ~32 entries. @@ -327,7 +327,7 @@ void CompareState(double timestamp, RigidbodyState state) // if this ever causes issues, feel free to disable it. if (compareLastFirst && Vector3.Distance(state.position, rb.position) < correctionThreshold) { - // Debug.Log($"CompareState for {name}: taking optimized early return!"); + // Debug.Log($"OnReceivedState for {name}: taking optimized early return!"); return; } @@ -467,8 +467,8 @@ public override void OnDeserialize(NetworkReader reader, bool initialState) Quaternion rotation = reader.ReadQuaternion(); Vector3 velocity = reader.ReadVector3(); - // compare state without deltas - CompareState(timestamp, new RigidbodyState(timestamp, Vector3.zero, position, rotation, Vector3.zero, velocity)); + // process received state + OnReceivedState(timestamp, new RigidbodyState(timestamp, Vector3.zero, position, rotation, Vector3.zero, velocity)); } protected override void OnValidate()