Phaser API Documentation

renderConstraint(constraint, graphics, lineColor, lineOpacity, lineThickness, pinSize, anchorColor, anchorSize)


Renders a single Matter Constraint, such as a Pin or a Spring, to the given Phaser Graphics Game Object.

This method is used internally by the Matter Debug Renderer, but is also exposed publically should you wish to render a Constraint to your own Graphics instance.


name type description
constraint MatterJS.ConstraintType

The Matter Constraint to render.

graphics Phaser.GameObjects.Graphics

The Graphics object to render to.

lineColor number

The line color.

lineOpacity number

The line opacity, between 0 and 1.

lineThickness number

The line thickness.

pinSize number

If this constraint is a pin, this sets the size of the pin circle.

anchorColor number

The color used when rendering this constraints anchors. Set to null to not render anchors.

anchorSize number

The size of the anchor circle, if this constraint has anchors and is rendering them.


This Matter World instance for method chaining.

Since: 3.22.0