diff --git a/Assets/Mirror/Core/SnapshotInterpolation/SnapshotInterpolation.cs b/Assets/Mirror/Core/SnapshotInterpolation/SnapshotInterpolation.cs index 37284d604..d0c08cfeb 100644 --- a/Assets/Mirror/Core/SnapshotInterpolation/SnapshotInterpolation.cs +++ b/Assets/Mirror/Core/SnapshotInterpolation/SnapshotInterpolation.cs @@ -35,13 +35,13 @@ public static double Timescale( double drift, // how far we are off from bufferTime double catchupSpeed, // in % [0,1] double slowdownSpeed, // in % [0,1] - double catchupNegativeThreshold, // in % of sendInteral (careful, we may run out of snapshots) - double catchupPositiveThreshold) // in % of sendInterval + double absoluteCatchupNegativeThreshold, // in seconds (careful, we may run out of snapshots) + double absoluteCatchupPositiveThreshold) // in seconds { // if the drift time is too large, it means we are behind more time. // so we need to speed up the timescale. // note the threshold should be sendInterval * catchupThreshold. - if (drift > catchupPositiveThreshold) + if (drift > absoluteCatchupPositiveThreshold) { // localTimeline += 0.001; // too simple, this would ping pong return 1 + catchupSpeed; // n% faster @@ -50,7 +50,7 @@ public static double Timescale( // if the drift time is too small, it means we are ahead of time. // so we need to slow down the timescale. // note the threshold should be sendInterval * catchupThreshold. - if (drift < catchupNegativeThreshold) + if (drift < absoluteCatchupNegativeThreshold) { // localTimeline -= 0.001; // too simple, this would ping pong return 1 - slowdownSpeed; // n% slower diff --git a/Assets/Mirror/Tests/Editor/SnapshotInterpolationTests.cs b/Assets/Mirror/Tests/Editor/SnapshotInterpolationTests.cs index adeacba61..4e1780147 100644 --- a/Assets/Mirror/Tests/Editor/SnapshotInterpolationTests.cs +++ b/Assets/Mirror/Tests/Editor/SnapshotInterpolationTests.cs @@ -34,8 +34,8 @@ public class SnapshotInterpolationTests // some defaults const double catchupSpeed = 0.02; const double slowdownSpeed = 0.04; - const double negativeThresh = -0.10; - const double positiveThresh = 0.10; + const double negativeThresh = -0.10; // in seconds + const double positiveThresh = 0.10; // in seconds [SetUp] public void SetUp()