Phaser API Documentation

  Version: 
getDelta: function

Description:

This function is called every time the core game loop steps, which is bound to the Request Animation Frame frequency unless otherwise modified.

The function is passed two values: time and delta, both of which come from the game step values.

It must return a number. This number is used as the delta value passed to Matter.Engine.update.

You can override this function with your own to define your own timestep.

If you need to update the Engine multiple times in a single game step then call World.update as many times as required. Each call will trigger the getDelta function. If you wish to have full control over when the Engine updates then see the property autoUpdate.

You can also adjust the number of iterations that Engine.update performs. Use the Scene Matter Physics config object to set the following properties:

positionIterations (defaults to 6) velocityIterations (defaults to 4) constraintIterations (defaults to 2)

Adjusting these values can help performance in certain situations, depending on the physics requirements of your game.

Type:
function
Since: 3.4.0