Phaser API Documentation

renderBodyBounds(bodies, graphics, lineColor, lineOpacity)


Renders the bounds of an array of Bodies to the given Graphics instance.

If the body is a compound body, it will render the bounds for the parent compound.

The debug renderer calls this method if the showBounds config value is set.

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


name type description
bodies array

An array of bodies from the localWorld.

graphics Phaser.GameObjects.Graphics

The Graphics object to render to.

lineColor number

The line color.

lineOpacity number

The line opacity, between 0 and 1.

Since: 3.22.0