Phaser API Documentation

setGameObject(gameObject, [update])


Changes the Game Object this Body is bound to. First it removes its reference from the old Game Object, then sets the new one. You can optionally update the position and dimensions of this Body to reflect that of the new Game Object.


name type arguments Default description
gameObject Phaser.GameObjects.GameObject

The new Game Object that will own this Body.

update boolean <optional> true

Reposition and resize this Body to match the new Game Object?


This Static Body object.

Since: 3.1.0