Phaser API Documentation

  Version: 
renderBody(body, graphics, showInternalEdges, [lineColor], [lineOpacity], [lineThickness], [fillColor], [fillOpacity])

Description:

Renders a single Matter Body 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 Body to your own Graphics instance.

If you don't wish to render a line around the body, set the lineColor parameter to null. Equally, if you don't wish to render a fill, set the fillColor parameter to null.

Parameters:

name type arguments Default description
body MatterJS.BodyType

The Matter Body to be rendered.

graphics Phaser.GameObjects.Graphics

The Graphics object to render to.

showInternalEdges boolean

Render internal edges of the polygon?

lineColor number <optional>

The line color.

lineOpacity number <optional>

The line opacity, between 0 and 1.

lineThickness number <optional> 1

The line thickness.

fillColor number <optional>

The fill color.

fillOpacity number <optional>

The fill opacity, between 0 and 1.

Returns:
Description:

This Matter World instance for method chaining.

Since: 3.22.0