Phaser API Documentation

  Version: 
MatterSetBodyConfig
Properties:
name type arguments Default description
type string <optional> 'rectangle'

The shape type. Either rectangle, circle, trapezoid, polygon, fromVertices, fromVerts or fromPhysicsEditor.

x number <optional>

The horizontal world position to place the body at.

y number <optional>

The vertical world position to place the body at.

width number <optional>

The width of the body.

height number <optional>

The height of the body.

radius number <optional>

The radius of the body. Used by circle and polygon shapes.

maxSides number <optional> 25

The max sizes of the body. Used by the circle shape.

slope number <optional> 0.5

Used by the trapezoid shape. The slope of the trapezoid. 0 creates a rectangle, while 1 creates a triangle. Positive values make the top side shorter, while negative values make the bottom side shorter.

sides number <optional> 5

Used by the polygon shape. The number of sides the polygon will have.

verts string | array <optional>

Used by the fromVerts shape. The vertices data. Either a path string or an array of vertices.

flagInternal boolean <optional> false

Used by the fromVerts shape. Flag internal edges (coincident part edges)

removeCollinear number <optional> 0.01

Used by the fromVerts shape. Whether Matter.js will discard collinear edges (to improve performance).

minimumArea number <optional> 10

Used by the fromVerts shape. During decomposition discard parts that have an area less than this.

addToWorld boolean <optional> true

Should the new body be automatically added to the world?

Type:
object