mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
SnapshotInterpolation.Timescale: rename threshold parameters to absolute and update comment. because that's what they are.
This commit is contained in:
parent
f62d68dbf3
commit
b1e62cfac3
@ -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
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user