parent

open var parent: Node?

Changes the parent node.

If set to null, this node will be detached.

The local position, rotation, and scale of this node will remain the same. Therefore, the world position, rotation, and scale of this node may be different after the parent changes.

In addition to setting this field, it will also do the following things:

  • Remove this node from its previous parent's children.

  • Add this node to its new parent's children.

  • Recursively update the node's transformation to reflect the change in parent.

  • Recursively update the scene field to match the new parent's scene field.