Phaser API Documentation

  Version: 
setBodySize(width, height, [center])

Description:

Sets the size of this physics body. Setting the size does not adjust the dimensions of the parent Game Object.

Parameters:

name type arguments Default description
width number

The new width of the physics body, in pixels.

height number

The new height of the physics body, in pixels.

center boolean <optional> true

Should the body be re-positioned so its center aligns with the parent Game Object?

Returns:
Description:

This Game Object.

Since: 3.24.0