add(_:at:)
Adds an object to the tree corresponding to the specified point in 2D space.
Declaration
func add(_ element: ElementType, at point: vector_float2) -> GKQuadtreeNodeParameters
- 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 GKQuadtree 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.