Skip to content

Commit 643329a

Browse files
update
Making smooth lerp a slightly faster for LEB and SD interpolation types.
1 parent 82306c0 commit 643329a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

com.unity.netcode.gameobjects/Runtime/Components/Interpolator/BufferedLinearInterpolator.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ private void TryConsumeFromBuffer(double renderTime, double minDeltaTime, double
377377
if (isPredictedLerp)
378378
{
379379
InterpolateState.Phase1Value = InterpolateState.PreviousValue;
380-
InterpolateState.Phase2Value = Interpolate(InterpolateState.PreviousValue, target.Item, InterpolateState.AverageDeltaTime);
380+
InterpolateState.Phase2Value = Interpolate(InterpolateState.PredictValue, target.Item, InterpolateState.AverageDeltaTime);
381381
}
382382
else
383383
{
@@ -462,8 +462,8 @@ internal T Update(float deltaTime, double tickLatencyAsTime, double minDeltaTime
462462
// If lerp smoothing is enabled, then smooth current value towards the target value
463463
if (LerpSmoothEnabled)
464464
{
465-
// Apply the smooth lerp from the oneThirpoint to the target to help smooth the final value
466-
InterpolateState.CurrentValue = Interpolate(InterpolateState.CurrentValue, targetValue, deltaTime / MaximumInterpolationTime);
465+
// Apply the smooth lerp to the target to help smooth the final value.
466+
InterpolateState.CurrentValue = Interpolate(InterpolateState.CurrentValue, targetValue, deltaTime / (MaximumInterpolationTime * 0.3333f));
467467
}
468468
else
469469
{

0 commit comments

Comments
 (0)