Skip to content

Commit 9eb1676

Browse files
committed
Seed history properly and dt clamp.
1 parent e5b82eb commit 9eb1676

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

v3/src/boot/VariableTimeStep.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ VariableTimeStep.prototype = {
5454

5555
for (var i = 0; i < this.deltaSmoothingMax; i++)
5656
{
57-
history[i] = 0;
57+
history[i] = 0.0166;
5858
}
5959

6060
this.delta = 0;
@@ -76,16 +76,19 @@ VariableTimeStep.prototype = {
7676
// delta time
7777
var dt = (time - this.lastTime) / 1000;
7878

79-
if (dt < 0 || dt > 1)
79+
// min / max range
80+
if (dt < 0.0001 || dt > 0.5)
8081
{
8182
// Probably super bad start time or browser tab inactivity / context loss
8283
// so use the last 'sane' dt value
8384

85+
console.log('dt sync', dt, 'ms over', history[idx]);
86+
8487
dt = history[idx];
85-
}
8688

87-
// clamp delta to 0.0001 to 0.5 range
88-
dt = Math.max(Math.min(dt, 0.5), 0.0001);
89+
// clamp delta to 0.0001 to 0.5 range
90+
dt = Math.max(Math.min(dt, 0.5), 0.0001);
91+
}
8992

9093
// Smooth out the delta over the previous X frames
9194

v3/src/checksum.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
var CHECKSUM = {
2-
build: '1fea37a0-2f97-11e7-93dd-fd6f78427b2e'
2+
build: 'f7392da0-2f9d-11e7-ba4c-5959ed8510b1'
33
};
44
module.exports = CHECKSUM;

0 commit comments

Comments
 (0)