I don’t really use Matter and I don’t have a 144 Hz monitor but here are my impressions.
By default Matter makes a variable-sized step using the minimum delta from the last 60 frames, clamped within 16–33 ms:
These values are fine for browser animation rates of 30–60 fps but above or below that Matter will be running ahead or behind the game step rate.
You could limit Phaser’s frame rate to 60 fps also:
new Phaser.Game({
fps: {
forceSetTimeOut: true,
target: 60
},
physics: {
default: 'matter',
matter: {
runner: {
fps: 60
}
}
}
});
Or you could have Matter use Phaser’s delta:
new Phaser.Game({
physics: {
default: 'matter',
matter: {
getDelta: function () {
return this.scene.game.loop.delta;
},
runner: {
// `isFixed` means use `getDelta()`
isFixed: true
}
}
}
});
You probably don’t want to enable matter.runner.isFixed
by itself, because that will make Matter run a fixed-size step (60 Hz) no matter what Phaser’s delta is. Likewise with set60Hz() and set30Hz().
A good solution might be to turn off Matter’s autoUpdate
and step through the game loop delta manually at a fixed rate:
Beware that applyForce() and thrust() are still timestep dependent.