Phaser API Documentation

  Version: 
setGameObject(gameObject, [update])

Description:

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.

Parameters:

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?

Returns:
Description:

This Static Body object.

Since: 3.1.0