kinematic blending

This commit is contained in:
mischa 2024-04-26 19:36:00 +08:00
parent 04016bdab4
commit 5740cbc09f

View File

@ -225,6 +225,10 @@ protected void BeginPredicting()
Quaternion predictionEndRotation = Quaternion.identity; Quaternion predictionEndRotation = Quaternion.identity;
protected void BeginBlending() protected void BeginBlending()
{ {
// blending interpolates from prediction to expected transform sync.
// this can be done entirely in memory, without physics.
predictedRigidbody.isKinematic = true;
state = ForecastState.BLENDING; state = ForecastState.BLENDING;
// if (debugColors) rend.material.color = blendingAheadColor; set in update depending on ahead/behind // if (debugColors) rend.material.color = blendingAheadColor; set in update depending on ahead/behind
@ -248,7 +252,6 @@ protected void BeginBlending()
protected void BeginFollowing() protected void BeginFollowing()
{ {
predictedRigidbody.isKinematic = true; // full transform sync
state = ForecastState.FOLLOWING; state = ForecastState.FOLLOWING;
if (debugColors) rend.material.color = originalColor; if (debugColors) rend.material.color = originalColor;
// reset the collision chain depth so it starts at 0 again next time // reset the collision chain depth so it starts at 0 again next time