Phaser API Documentation

  Version: 
Filter
This is a beta release of our new docs system. Found an issue?
Please tell us about it in the #📖-newdocs-feedback channel on the Phaser Discord
Namespace: Matter
Phaser.Physics.Matter

Classes

Namespace

Methods

<static> MatterGameObject(world, gameObject, [options], [addToWorld])
Focus
Focus

Description:

A Matter Game Object is a generic object that allows you to combine any Phaser Game Object, including those you have extended or created yourself, with all of the Matter Components.

This enables you to use component methods such as setVelocity or isSensor directly from this Game Object.

Parameters:

name type arguments Default description
world Phaser.Physics.Matter.World

The Matter world to add the body to.

gameObject Phaser.GameObjects.GameObject

The Game Object that will have the Matter body applied to it.

options MatterJS.Body | Phaser.Types.Physics.Matter.MatterBodyConfig <optional>

A Matter Body configuration object, or an instance of a Matter Body.

addToWorld boolean <optional> true

Should the newly created body be immediately added to the World?

Returns:
Description:

The Game Object that was created with the Matter body.

Examples:
Since: 3.3.0
Focus
Focus