Contents

add(_:in:)

Adds an object to the tree corresponding to the specified volume of 3D space.

Declaration

func add(_ element: ElementType, in box: GKBox) -> GKOctreeNode

Parameters

  • element:

    The object to add to the tree.

Return Value

The tree node containing the newly added object.

Discussion

The GKOctree class automatically creates nodes to manage the objects you add to the tree. If you expect to remove an element you’ve added, keep a reference to the node this method returns so you can use the remove(_:using:) method to remove that object quickly.

See Also

Adding and Removing Elements