Namespace: Events

Phaser.Physics.Matter. Events

Type Definitions


AfterUpdateEvent

Type:
  • object
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.

Source: src/physics/matter-js/events/AFTER_UPDATE_EVENT.js (Line 7)

BeforeUpdateEvent

Type:
  • object
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.

Source: src/physics/matter-js/events/BEFORE_UPDATE_EVENT.js (Line 7)

CollisionActiveEvent

Type:
  • object
Properties:
Name Type Description
pairs array

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.

Source: src/physics/matter-js/events/COLLISION_ACTIVE_EVENT.js (Line 7)

CollisionEndEvent

Type:
  • object
Properties:
Name Type Description
pairs array

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.

Source: src/physics/matter-js/events/COLLISION_END_EVENT.js (Line 7)

CollisionStartEvent

Type:
  • object
Properties:
Name Type Description
pairs array

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.

Source: src/physics/matter-js/events/COLLISION_START_EVENT.js (Line 7)

SleepEndEvent

Type:
  • object
Properties:
Name Type Description
source any

The source object of the event.

name string

The name of the event.

Source: src/physics/matter-js/events/SLEEP_END_EVENT.js (Line 7)

SleepStartEvent

Type:
  • object
Properties:
Name Type Description
source any

The source object of the event.

name string

The name of the event.

Source: src/physics/matter-js/events/SLEEP_START_EVENT.js (Line 7)

Events


AFTER_UPDATE

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.

Source: src/physics/matter-js/events/AFTER_UPDATE_EVENT.js (Line 15)

BEFORE_UPDATE

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.

Source: src/physics/matter-js/events/BEFORE_UPDATE_EVENT.js (Line 15)

COLLISION_ACTIVE

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.Body

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

bodyB MatterJS.Body

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

Source: src/physics/matter-js/events/COLLISION_ACTIVE_EVENT.js (Line 16)

COLLISION_END

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.Body

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

bodyB MatterJS.Body

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

Source: src/physics/matter-js/events/COLLISION_END_EVENT.js (Line 16)

COLLISION_START

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.Body

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

bodyB MatterJS.Body

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

Source: src/physics/matter-js/events/COLLISION_START_EVENT.js (Line 16)

DRAG

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.Body

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.

Source: src/physics/matter-js/events/DRAG_EVENT.js (Line 7)

DRAG_END

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.Body

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.

Source: src/physics/matter-js/events/DRAG_END_EVENT.js (Line 7)

DRAG_START

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.Body

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

part MatterJS.Body

The part of the body that was clicked on.

constraint Phaser.Physics.Matter.PointerConstraint

The Pointer Constraint that is dragging the body.

Source: src/physics/matter-js/events/DRAG_START_EVENT.js (Line 7)

PAUSE

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

Source: src/physics/matter-js/events/PAUSE_EVENT.js (Line 7)

RESUME

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

Source: src/physics/matter-js/events/RESUME_EVENT.js (Line 7)

SLEEP_END

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.Body

The body that has stopped sleeping.

Source: src/physics/matter-js/events/SLEEP_END_EVENT.js (Line 14)

SLEEP_START

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.Body

The body that has gone to sleep.

Source: src/physics/matter-js/events/SLEEP_START_EVENT.js (Line 14)