Phaser API Documentation

  Version: 
setGravity([x], [y], [scale])

Description:

Sets the worlds gravity to the values given.

Gravity effects all bodies in the world, unless they have the ignoreGravity flag set.

Parameters:

name type arguments Default description
x number <optional> 0

The world gravity x component.

y number <optional> 1

The world gravity y component.

scale number <optional> 0.001

The gravity scale factor.

Returns:
Description:

This Matter World object.

Since: 3.0.0