Skip to content

Commit 41b9e7d

Browse files
committed
Delta history populated with _target value. resetDelta uses smaller value (target or previous dt). Step only resets dt if > target.
1 parent 1a2520a commit 41b9e7d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

v3/src/boot/TimeStep.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ var TimeStep = new Class({
6969
// The actual elapsed time in ms between one update and the next.
7070
// No smoothing, no capping, no averaging. So please be aware of this when using the contents of this property.
7171
this.rawDelta = 0;
72+
73+
for (var i = 0; i < this.deltaSmoothingMax; i++)
74+
{
75+
this.deltaHistory[i] = this._target;
76+
}
7277
},
7378

7479
// Called when the DOM window.onBlur event triggers
@@ -121,7 +126,7 @@ var TimeStep = new Class({
121126

122127
for (var i = 0; i < this.deltaSmoothingMax; i++)
123128
{
124-
this.deltaHistory[i] = 0;
129+
this.deltaHistory[i] = Math.min(this._target, this.deltaHistory[i]);
125130
}
126131

127132
this.delta = 0;
@@ -178,7 +183,8 @@ var TimeStep = new Class({
178183
{
179184
this._coolDown--;
180185

181-
dt = this._target;
186+
dt = Math.min(dt, this._target);
187+
182188
// debug = (time - this.lastTime);
183189
}
184190

0 commit comments

Comments
 (0)