Phaser API Documentation

  Version: 
setRectangle(width, height, [options])

Description:

Set the body on a Game Object to a rectangle.

Calling this methods resets previous properties you may have set on the body, including plugins, mass, friction, etc. So be sure to re-apply these in the options object if needed.

Parameters:

name type arguments description
width number

Width of the rectangle.

height number

Height of the rectangle.

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.

Since: 3.0.0