Instance Method

add(_:at:)

Adds an object to the tree corresponding to the specified point in 3D space.

Declaration

func add(_ element: ElementType, at point: vector_float3) -> GKOctreeNode

Parameters

element

The object to add to the tree.

point

The point in 2D space to which the object corresponds.

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

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

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

func remove(ElementType, using: GKOctreeNode) -> Bool

Removes the specified object from the tree, using a reference to its containing node.

func remove(ElementType) -> Bool

Searches for the specified object and removes it from the tree.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software