From 15452d1f9b08f1ed06105fb9f82198b5b114f632 Mon Sep 17 00:00:00 2001 From: mischa Date: Wed, 3 Apr 2024 18:57:38 +0800 Subject: [PATCH] transition to FOLLOWING --- .../Components/ForecastRigidbody/ForecastRigidbody.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Assets/Mirror/Components/ForecastRigidbody/ForecastRigidbody.cs b/Assets/Mirror/Components/ForecastRigidbody/ForecastRigidbody.cs index 5189823a1..13b75e203 100644 --- a/Assets/Mirror/Components/ForecastRigidbody/ForecastRigidbody.cs +++ b/Assets/Mirror/Components/ForecastRigidbody/ForecastRigidbody.cs @@ -135,7 +135,7 @@ protected void BeginBlending() Debug.Log($"{name} BEGIN BLENDING"); } - protected void BeginFollow() + protected void BeginFollowing() { predictedRigidbody.isKinematic = true; // full transform sync state = ForecastState.FOLLOWING; @@ -272,6 +272,13 @@ void FixedUpdateClient() // assign rigidbody position & rotation while keeping velocity to keep moving predictedRigidbody.MovePosition(newPosition); predictedRigidbody.MoveRotation(newRotation); + + // transition to FOLLOWING once p = 100% + if (p >= 1) + { + Debug.Log($"{name} END BLENDING"); + BeginFollowing(); + } } else if (state == ForecastState.FOLLOWING) {