Phaser API Documentation

  Version: 
setBodyRenderStyle(body, [lineColor], [lineOpacity], [lineThickness], [fillColor], [fillOpacity])

Description:

Sets the debug render style for the given Matter Body.

If you are using this on a Phaser Game Object, such as a Matter Sprite, then pass in the body property to this method, not the Game Object itself.

If you wish to skip a parameter, so it retains its current value, pass false for it.

If you wish to reset the Body render colors to the defaults found in the World Debug Config, then call this method with just the body parameter provided and no others.

Parameters:

name type arguments description
body MatterJS.BodyType

The Matter Body to set the render style on.

lineColor number <optional>

The line color. If null it will use the World Debug Config value.

lineOpacity number <optional>

The line opacity, between 0 and 1. If null it will use the World Debug Config value.

lineThickness number <optional>

The line thickness. If null it will use the World Debug Config value.

fillColor number <optional>

The fill color. If null it will use the World Debug Config value.

fillOpacity number <optional>

The fill opacity, between 0 and 1. If null it will use the World Debug Config value.

Returns:
Description:

This Matter World instance for method chaining.

Since: 3.22.0