the physic world this QuadTree belongs to
bounds of the node
Optionalmax_objects: number = 4max objects a node can hold before splitting into 4 subnodes
Optionalmax_levels: number = 4total max levels inside root Quadtree
Optionallevel: number = 0deepth level, required for subnodes
return true if the node has any children
true if the node has any children
Insert the given object into the node. If the node exceeds the capacity, it will split and add all objects to their corresponding subnodes.
object to be added
Insert the given object container into the node.
group of objects to be added
return true if the node is prunable
true if the node is prunable
Remove the given item from the quadtree. (this function won't recalculate the impacted node)
object to be removed
true if the item was found and removed.
Return all objects that could collide with the given object
object to be checked against
Optionalfn: objecta sorting function for the returned array
array with all detected objects
a QuadTree implementation in JavaScript, a 2d spatial subdivision algorithm.
See
game.world.broadphase