Skip to content

Commit c8e0f91

Browse files
authored
Merge pull request phaserjs#4989 from jjcapellan/syncToRender
New property Arcade.World.fixedStep
2 parents 43670b1 + 327748b commit c8e0f91

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

src/physics/arcade/World.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,17 @@ var World = new Class({
154154
*/
155155
this.fps = GetValue(config, 'fps', 60);
156156

157+
/**
158+
* Should Physics use a fixed update time-step (true) or sync to the render fps (false)?.
159+
* False value of this property disables fps and timeScale properties.
160+
*
161+
* @name Phaser.Physics.Arcade.World#fixedStep
162+
* @type {boolean}
163+
* @default true
164+
* @since 3.23.0
165+
*/
166+
this.fixedStep = true;
167+
157168
/**
158169
* The amount of elapsed ms since the last frame.
159170
*
@@ -927,6 +938,13 @@ var World = new Class({
927938
// Will a step happen this frame?
928939
var willStep = (this._elapsed >= msPerFrame);
929940

941+
if(!this.fixedStep)
942+
{
943+
fixedDelta = delta * 0.001;
944+
willStep = true;
945+
this._elapsed = 0;
946+
}
947+
930948
for (i = 0; i < bodies.length; i++)
931949
{
932950
body = bodies[i];

0 commit comments

Comments
 (0)