Phaser API Documentation

  Version: 
setPolygon(radius, sides, [options])

Description:

Set this Game Objects Matter physics body to be a polygon shape.

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
radius number

The "radius" of the polygon, i.e. the distance from its center to any vertex. This is also the radius of its circumcircle.

sides number

The number of sides the polygon will have.

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