Initializes an octree with the specified dimensions.


init(boundingBox box: GKBox, minimumCellSize minCellSize: Float)



The axis-aligned rectangular bounding volume encompassing all possible elements of the tree. Elements added to the tree must lie entirely within this box.


The minimum dimension (width, height, and depth) of a node in the tree.

Return Value

A new octree object.


The minCellSize parameter controls the memory usage and performance of the tree. A lower value causes the tree to make more spatial divisions when adding elements; a higher value causes the tree to create fewer such divisions, but store more elements in each node. Which direction leads to better performance depends on the number and spatial arrangement of the elements you add to the tree—for best results, profile with different values to find one best suited to your app or game.

See Also