Phaser API Documentation

polygon(x, y, sides, radius, [options])


Creates a new rigid polygonal Body and adds it to the World.


name type arguments description
x number

The X coordinate of the center of the Body.

y number

The Y coordinate of the center of the Body.

sides number

The number of sides the polygon will have.

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.

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

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


A Matter JS Body.

  • MatterJS.BodyType
Since: 3.0.0