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: Mass
Phaser.Physics.Matter.Components.Mass

Members

<readonly> centerOfMass: Phaser.Math.Vector2
Focus
Focus

Description:

The body's center of mass.

Calling this creates a new `Vector2 each time to avoid mutation.

If you only need to read the value and won't change it, you can get it from GameObject.body.centerOfMass.

Type:
Since: 3.10.0
Focus
Focus

Methods

setMass(value)
Focus
Focus

Description:

Sets the mass of the Game Object's Matter Body.

Parameters:

name type description
value number

The new mass of the body.

Returns:
Description:

This Game Object.

Examples:
Since: 3.0.0
Focus
Focus
setDensity(value)
Focus
Focus

Description:

Sets density of the body.

Parameters:

name type description
value number

The new density of the body.

Returns:
Description:

This Game Object.

Examples:
Since: 3.0.0
Focus
Focus