Sets the body offset. This allows you to adjust the difference between the center of the body and the x and y coordinates of the parent Game Object.
name | type | arguments | Default | description |
---|---|---|---|---|
x | number |
The amount to offset the body from the parent Game Object along the x-axis. |
||
y | number | <optional> | x |
The amount to offset the body from the parent Game Object along the y-axis. Defaults to the value given for the x-axis. |
This Game Object.
DEPRECATED: Please use setBodySize
instead.
Sets the size of this physics body. Setting the size does not adjust the dimensions of the parent Game Object.
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? |
This Game Object.
Sets the size of this physics body. Setting the size does not adjust the dimensions of the parent Game Object.
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? |
This Game Object.
Sets this physics body to use a circle for collision instead of a rectangle.
name | type | arguments | description |
---|---|---|---|
radius | number |
The radius of the physics body, in pixels. |
|
offsetX | number | <optional> |
The amount to offset the body from the parent Game Object along the x-axis. |
offsetY | number | <optional> |
The amount to offset the body from the parent Game Object along the y-axis. |
This Game Object.