Phaser API Documentation

  Version: 
setBody(config, [options])

Description:

Set this Game Object to create and use a new Body based on the configuration object given.

Calling this methods resets all previous properties you may have set on the body, including plugins, mass, friction, collision categories, etc. So be sure to re-apply these as needed.

Parameters:

name type arguments description
config string | Phaser.Types.Physics.Matter.MatterSetBodyConfig

Either a string, such as circle, or a Matter Set Body Configuration object.

options Phaser.Types.Physics.Matter.MatterBodyConfig <optional>

An optional Body configuration object that is used to set initial Body properties on creation.

Returns:
Description:

This Game Object instance.

Since: 3.0.0