Class: MatterPhysics

Phaser.Physics.Matter. MatterPhysics

[description]


new MatterPhysics(scene)

Parameters:
Name Type Description
scene Phaser.Scene

[description]

Since: 3.0.0
Source: src/physics/matter-js/MatterPhysics.js (Line 23)

Members


add :Phaser.Physics.Matter.Factory

[description]

Type:
Since: 3.0.0
Source: src/physics/matter-js/MatterPhysics.js (Line 76)

bodies :MatterJS.Bodies

A reference to the Matter.Bodies module which contains methods for creating bodies.

Type:
Since: 3.18.0
Source: src/physics/matter-js/MatterPhysics.js (Line 105)

body :MatterJS.Body

A reference to the Matter.Body module which contains methods for creating and manipulating body models.

Type:
Since: 3.18.0
Source: src/physics/matter-js/MatterPhysics.js (Line 96)

config :object

[description]

Type:
  • object
Since: 3.0.0
Source: src/physics/matter-js/MatterPhysics.js (Line 58)

scene :Phaser.Scene

[description]

Type:
Since: 3.0.0
Source: src/physics/matter-js/MatterPhysics.js (Line 40)

systems :Phaser.Scenes.Systems

[description]

Type:
Since: 3.0.0
Source: src/physics/matter-js/MatterPhysics.js (Line 49)

verts :MatterJS.Vertices

A reference to the Matter.Vertices module which contains methods for creating and manipulating sets of vertices. A set of vertices is an array of Matter.Vector with additional indexing properties inserted by Vertices.create. A Matter.Body maintains a set of vertices to represent the shape of the object (its convex hull).

Type:
Since: 3.14.0
Source: src/physics/matter-js/MatterPhysics.js (Line 85)

world :Phaser.Physics.Matter.World

[description]

Type:
Since: 3.0.0
Source: src/physics/matter-js/MatterPhysics.js (Line 67)

Methods


enableAttractorPlugin()

[description]

Since: 3.0.0
Source: src/physics/matter-js/MatterPhysics.js (Line 193)
Returns:

This Matter Physics instance.

Type
Phaser.Physics.Matter.MatterPhysics

enableWrapPlugin()

[description]

Since: 3.0.0
Source: src/physics/matter-js/MatterPhysics.js (Line 209)
Returns:

This Matter Physics instance.

Type
Phaser.Physics.Matter.MatterPhysics

getConfig()

[description]

Since: 3.0.0
Source: src/physics/matter-js/MatterPhysics.js (Line 172)
Returns:

[description]

Type
object

pause()

[description]

Since: 3.0.0
Source: src/physics/matter-js/MatterPhysics.js (Line 225)
Returns:

The Matter World object.

Type
Phaser.Physics.Matter.World

resume()

[description]

Since: 3.0.0
Source: src/physics/matter-js/MatterPhysics.js (Line 238)
Returns:

The Matter World object.

Type
Phaser.Physics.Matter.World

set30Hz()

Sets the Matter Engine to run at fixed timestep of 30Hz and enables autoUpdate. If you have set a custom getDelta function then this will override it.

Since: 3.4.0
Source: src/physics/matter-js/MatterPhysics.js (Line 268)
Returns:

This Matter Physics instance.

Type
Phaser.Physics.Matter.MatterPhysics

set60Hz()

Sets the Matter Engine to run at fixed timestep of 60Hz and enables autoUpdate. If you have set a custom getDelta function then this will override it.

Since: 3.4.0
Source: src/physics/matter-js/MatterPhysics.js (Line 251)
Returns:

This Matter Physics instance.

Type
Phaser.Physics.Matter.MatterPhysics

step( [delta] [, correction])

Manually advances the physics simulation by one iteration.

You can optionally pass in the delta and correction values to be used by Engine.update. If undefined they use the Matter defaults of 60Hz and no correction.

Calling step directly bypasses any checks of enabled or autoUpdate.

It also ignores any custom getDelta functions, as you should be passing the delta value in to this call.

You can adjust the number of iterations that Engine.update performs internally. 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.

Parameters:
Name Type Argument Default Description
delta number <optional>
16.666

[description]

correction number <optional>
1

[description]

Since: 3.4.0
Source: src/physics/matter-js/MatterPhysics.js (Line 285)