Skip to main content
Version: Phaser v4.0.0-rc.6

Phaser.Physics.Matter

Scope: static

Source: src/physics/matter-js/index.js#L7

Static functions

Static functions

Static functions

MatterGameObject

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

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:

nametypeoptionaldefaultdescription
worldPhaser.Physics.Matter.WorldNoThe Matter world to add the body to.
gameObjectPhaser.GameObjects.GameObjectNoThe Game Object that will have the Matter body applied to it.
optionsPhaser.Types.Physics.Matter.MatterBodyConfig | MatterJS.BodyYesA Matter Body configuration object, or an instance of a Matter Body.
addToWorldbooleanYestrueShould the newly created body be immediately added to the World?

Returns: Phaser.GameObjects.GameObject - The Game Object that was created with the Matter body.

Source: src/physics/matter-js/MatterGameObject.js#L26
Since: 3.3.0