transition to FOLLOWING

This commit is contained in:
mischa 2024-04-03 18:57:38 +08:00
parent 785aa036a3
commit 15452d1f9b

View File

@ -135,7 +135,7 @@ protected void BeginBlending()
Debug.Log($"{name} BEGIN BLENDING"); Debug.Log($"{name} BEGIN BLENDING");
} }
protected void BeginFollow() protected void BeginFollowing()
{ {
predictedRigidbody.isKinematic = true; // full transform sync predictedRigidbody.isKinematic = true; // full transform sync
state = ForecastState.FOLLOWING; state = ForecastState.FOLLOWING;
@ -272,6 +272,13 @@ void FixedUpdateClient()
// assign rigidbody position & rotation while keeping velocity to keep moving // assign rigidbody position & rotation while keeping velocity to keep moving
predictedRigidbody.MovePosition(newPosition); predictedRigidbody.MovePosition(newPosition);
predictedRigidbody.MoveRotation(newRotation); predictedRigidbody.MoveRotation(newRotation);
// transition to FOLLOWING once p = 100%
if (p >= 1)
{
Debug.Log($"{name} END BLENDING");
BeginFollowing();
}
} }
else if (state == ForecastState.FOLLOWING) else if (state == ForecastState.FOLLOWING)
{ {