Phaser API Documentation

  Version: 
Filter
Namespace: Events
Phaser.Physics.Matter.Events

Events

AFTER_ADD
Focus
Focus

Description:

The Matter Physics After Add Event.

This event is dispatched by a Matter Physics World instance at the end of the process when a new Body or Constraint has just been added to the world.

Listen to it from a Scene using: this.matter.world.on('afteradd', listener).

Parameters:

name type description
event Phaser.Physics.Matter.Events.AfterAddEvent

The Add Event object.

Focus
Focus
AFTER_REMOVE
Focus
Focus

Description:

The Matter Physics After Remove Event.

This event is dispatched by a Matter Physics World instance at the end of the process when a Body or Constraint was removed from the world.

Listen to it from a Scene using: this.matter.world.on('afterremove', listener).

Parameters:

name type description
event Phaser.Physics.Matter.Events.AfterRemoveEvent

The Remove Event object.

Focus
Focus
AFTER_UPDATE
Focus
Focus

Description:

The Matter Physics After Update Event.

This event is dispatched by a Matter Physics World instance after the engine has updated and all collision events have resolved.

Listen to it from a Scene using: this.matter.world.on('afterupdate', listener).

Parameters:

name type description
event Phaser.Physics.Matter.Events.AfterUpdateEvent

The Update Event object.

Focus
Focus
BEFORE_ADD
Focus
Focus

Description:

The Matter Physics Before Add Event.

This event is dispatched by a Matter Physics World instance at the start of the process when a new Body or Constraint is being added to the world.

Listen to it from a Scene using: this.matter.world.on('beforeadd', listener).

Parameters:

name type description
event Phaser.Physics.Matter.Events.BeforeAddEvent

The Add Event object.

Focus
Focus
BEFORE_REMOVE
Focus
Focus

Description:

The Matter Physics Before Remove Event.

This event is dispatched by a Matter Physics World instance at the start of the process when a Body or Constraint is being removed from the world.

Listen to it from a Scene using: this.matter.world.on('beforeremove', listener).

Parameters:

name type description
event Phaser.Physics.Matter.Events.BeforeRemoveEvent

The Remove Event object.

Focus
Focus
BEFORE_UPDATE
Focus
Focus

Description:

The Matter Physics Before Update Event.

This event is dispatched by a Matter Physics World instance right before all the collision processing takes place.

Listen to it from a Scene using: this.matter.world.on('beforeupdate', listener).

Parameters:

name type description
event Phaser.Physics.Matter.Events.BeforeUpdateEvent

The Update Event object.

Focus
Focus
COLLISION_ACTIVE
Focus
Focus

Description:

The Matter Physics Collision Active Event.

This event is dispatched by a Matter Physics World instance after the engine has updated. It provides a list of all pairs that are colliding in the current tick (if any).

Listen to it from a Scene using: this.matter.world.on('collisionactive', listener).

Parameters:

name type description
event Phaser.Physics.Matter.Events.CollisionActiveEvent

The Collision Event object.

bodyA MatterJS.BodyType

The first body of the first colliding pair. The event.pairs array may contain more colliding bodies.

bodyB MatterJS.BodyType

The second body of the first colliding pair. The event.pairs array may contain more colliding bodies.

Focus
Focus
COLLISION_END
Focus
Focus

Description:

The Matter Physics Collision End Event.

This event is dispatched by a Matter Physics World instance after the engine has updated. It provides a list of all pairs that have finished colliding in the current tick (if any).

Listen to it from a Scene using: this.matter.world.on('collisionend', listener).

Parameters:

name type description
event Phaser.Physics.Matter.Events.CollisionEndEvent

The Collision Event object.

bodyA MatterJS.BodyType

The first body of the first colliding pair. The event.pairs array may contain more colliding bodies.

bodyB MatterJS.BodyType

The second body of the first colliding pair. The event.pairs array may contain more colliding bodies.

Focus
Focus
COLLISION_START
Focus
Focus

Description:

The Matter Physics Collision Start Event.

This event is dispatched by a Matter Physics World instance after the engine has updated. It provides a list of all pairs that have started to collide in the current tick (if any).

Listen to it from a Scene using: this.matter.world.on('collisionstart', listener).

Parameters:

name type description
event Phaser.Physics.Matter.Events.CollisionStartEvent

The Collision Event object.

bodyA MatterJS.BodyType

The first body of the first colliding pair. The event.pairs array may contain more colliding bodies.

bodyB MatterJS.BodyType

The second body of the first colliding pair. The event.pairs array may contain more colliding bodies.

Focus
Focus
DRAG
Focus
Focus

Description:

The Matter Physics Drag Event.

This event is dispatched by a Matter Physics World instance when a Pointer Constraint is actively dragging a body. It is emitted each time the pointer moves.

Listen to it from a Scene using: this.matter.world.on('drag', listener).

Parameters:

name type description
body MatterJS.BodyType

The Body that is being dragged. This is a Matter Body, not a Phaser Game Object.

constraint Phaser.Physics.Matter.PointerConstraint

The Pointer Constraint that is dragging the body.

Since: 3.16.2
Focus
Focus
DRAG_END
Focus
Focus

Description:

The Matter Physics Drag End Event.

This event is dispatched by a Matter Physics World instance when a Pointer Constraint stops dragging a body.

Listen to it from a Scene using: this.matter.world.on('dragend', listener).

Parameters:

name type description
body MatterJS.BodyType

The Body that has stopped being dragged. This is a Matter Body, not a Phaser Game Object.

constraint Phaser.Physics.Matter.PointerConstraint

The Pointer Constraint that was dragging the body.

Since: 3.16.2
Focus
Focus
DRAG_START
Focus
Focus

Description:

The Matter Physics Drag Start Event.

This event is dispatched by a Matter Physics World instance when a Pointer Constraint starts dragging a body.

Listen to it from a Scene using: this.matter.world.on('dragstart', listener).

Parameters:

name type description
body MatterJS.BodyType

The Body that has started being dragged. This is a Matter Body, not a Phaser Game Object.

part MatterJS.BodyType

The part of the body that was clicked on.

constraint Phaser.Physics.Matter.PointerConstraint

The Pointer Constraint that is dragging the body.

Focus
Focus
PAUSE
Focus
Focus

Description:

The Matter Physics World Pause Event.

This event is dispatched by an Matter Physics World instance when it is paused.

Listen to it from a Scene using: this.matter.world.on('pause', listener).

Since: 3.0.0
Focus
Focus
RESUME
Focus
Focus

Description:

The Matter Physics World Resume Event.

This event is dispatched by an Matter Physics World instance when it resumes from a paused state.

Listen to it from a Scene using: this.matter.world.on('resume', listener).

Since: 3.0.0
Focus
Focus
SLEEP_END
Focus
Focus

Description:

The Matter Physics Sleep End Event.

This event is dispatched by a Matter Physics World instance when a Body stop sleeping.

Listen to it from a Scene using: this.matter.world.on('sleepend', listener).

Parameters:

name type description
event Phaser.Physics.Matter.Events.SleepEndEvent

The Sleep Event object.

body MatterJS.BodyType

The body that has stopped sleeping.

Focus
Focus
SLEEP_START
Focus
Focus

Description:

The Matter Physics Sleep Start Event.

This event is dispatched by a Matter Physics World instance when a Body goes to sleep.

Listen to it from a Scene using: this.matter.world.on('sleepstart', listener).

Parameters:

name type description
event Phaser.Physics.Matter.Events.SleepStartEvent

The Sleep Event object.

body MatterJS.BodyType

The body that has gone to sleep.

Focus
Focus

Type Definitions

AfterAddEvent
Focus
Focus
Properties:
name type description
object Array.<any>

An array of the object(s) that have been added. May be a single body, constraint, composite or a mixture of these.

source any

The source object of the event.

name string

The name of the event.

Type:
object
Focus
Focus
AfterRemoveEvent
Focus
Focus
Properties:
name type description
object Array.<any>

An array of the object(s) that were removed. May be a single body, constraint, composite or a mixture of these.

source any

The source object of the event.

name string

The name of the event.

Type:
object
Focus
Focus
AfterUpdateEvent
Focus
Focus
Properties:
name type description
timestamp number

The Matter Engine timing.timestamp value for the event.

source any

The source object of the event.

name string

The name of the event.

Type:
object
Focus
Focus
BeforeAddEvent
Focus
Focus
Properties:
name type description
object Array.<any>

An array of the object(s) to be added. May be a single body, constraint, composite or a mixture of these.

source any

The source object of the event.

name string

The name of the event.

Type:
object
Focus
Focus
BeforeRemoveEvent
Focus
Focus
Properties:
name type description
object Array.<any>

An array of the object(s) to be removed. May be a single body, constraint, composite or a mixture of these.

source any

The source object of the event.

name string

The name of the event.

Type:
object
Focus
Focus
BeforeUpdateEvent
Focus
Focus
Properties:
name type description
timestamp number

The Matter Engine timing.timestamp value for the event.

source any

The source object of the event.

name string

The name of the event.

Type:
object
Focus
Focus
CollisionActiveEvent
Focus
Focus
Properties:
name type description
pairs Array.<Phaser.Types.Physics.Matter.MatterCollisionData>

A list of all affected pairs in the collision.

timestamp number

The Matter Engine timing.timestamp value for the event.

source any

The source object of the event.

name string

The name of the event.

Type:
object
Focus
Focus
CollisionEndEvent
Focus
Focus
Properties:
name type description
pairs Array.<Phaser.Types.Physics.Matter.MatterCollisionData>

A list of all affected pairs in the collision.

timestamp number

The Matter Engine timing.timestamp value for the event.

source any

The source object of the event.

name string

The name of the event.

Type:
object
Focus
Focus
CollisionStartEvent
Focus
Focus
Properties:
name type description
pairs Array.<Phaser.Types.Physics.Matter.MatterCollisionData>

A list of all affected pairs in the collision.

timestamp number

The Matter Engine timing.timestamp value for the event.

source any

The source object of the event.

name string

The name of the event.

Type:
object
Focus
Focus
SleepEndEvent
Focus
Focus
Properties:
name type description
source any

The source object of the event.

name string

The name of the event.

Type:
object
Focus
Focus
SleepStartEvent
Focus
Focus
Properties:
name type description
source any

The source object of the event.

name string

The name of the event.

Type:
object
Focus
Focus