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 21)

Members


add :Phaser.Physics.Matter.Factory

[description]

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

config :object

[description]

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

scene :Phaser.Scene

[description]

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

systems :Phaser.Scenes.Systems

[description]

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

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 83)

world :Phaser.Physics.Matter.World

[description]

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

Methods


enableAttractorPlugin()

[description]

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

This Matter Physics instance.

Type
Phaser.Physics.Matter.MatterPhysics

enableWrapPlugin()

[description]

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

This Matter Physics instance.

Type
Phaser.Physics.Matter.MatterPhysics

getConfig()

[description]

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

[description]

Type
object

pause()

[description]

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

The Matter World object.

Type
Phaser.Physics.Matter.World

resume()

[description]

Since: 3.0.0
Source: src/physics/matter-js/MatterPhysics.js (Line 218)
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 248)
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 231)
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 265)