@@ -279,6 +279,7 @@ private void TryConsumeFromBuffer(double renderTime, float minDeltaTime, float m
279279 // TODO: We might consider creating yet another queue to add these items to and assure that the time is accelerated
280280 // for each item as opposed to losing the resolution of the values.
281281 InterpolateState . TimeToTargetValue = Mathf . Clamp ( ( float ) ( target . TimeSent - startTime ) , minDeltaTime , maxDeltaTime ) ;
282+
282283 InterpolateState . Target = target ;
283284 }
284285 InterpolateState . ResetDelta ( ) ;
@@ -321,11 +322,11 @@ public T Update(float deltaTime, double tickLatencyAsTime, float minDeltaTime, f
321322 // Smooth dampen our current time
322323 var current = SmoothDamp ( InterpolateState . CurrentValue , InterpolateState . Target . Value . Item , ref m_RateOfChange , InterpolateState . TimeToTargetValue , InterpolateState . DeltaTime ) ;
323324 // Smooth dampen a predicted time based on our average delta time
324- var predict = SmoothDamp ( InterpolateState . CurrentValue , InterpolateState . Target . Value . Item , ref m_PredictedRateOfChange , InterpolateState . TimeToTargetValue , InterpolateState . DeltaTime + InterpolateState . AverageDeltaTime ) ;
325- // Split the difference between the two .
325+ var predict = SmoothDamp ( InterpolateState . CurrentValue , InterpolateState . Target . Value . Item , ref m_PredictedRateOfChange , InterpolateState . TimeToTargetValue , InterpolateState . DeltaTime + ( InterpolateState . AverageDeltaTime * 2 ) ) ;
326+ // Lerp between the current and predicted .
326327 // Note: Since smooth dampening cannot over shoot, both current and predict will eventually become the same or will be very close to the same.
327328 // Upon stopping motion, the final resing value should be a very close aproximation of the authority side.
328- InterpolateState . CurrentValue = Interpolate ( current , predict , 0.5f ) ;
329+ InterpolateState . CurrentValue = Interpolate ( current , predict , deltaTime ) ;
329330 }
330331 m_NbItemsReceivedThisFrame = 0 ;
331332 return InterpolateState . CurrentValue ;
0 commit comments