Phaser API Documentation

useTree: boolean


Should this Arcade Physics World use an RTree for Dynamic bodies?

An RTree is a fast way of spatially sorting of all the bodies in the world. However, at certain limits, the cost of clearing and inserting the bodies into the tree every frame becomes more expensive than the search speed gains it provides.

If you have a large number of dynamic bodies in your world then it may be best to disable the use of the RTree by setting this property to false in the physics config.

The number it can cope with depends on browser and device, but a conservative estimate of around 5,000 bodies should be considered the max before disabling it.

This only applies to dynamic bodies. Static bodies are always kept in an RTree, because they don't have to be cleared every frame, so you benefit from the massive search speeds all the time.

Default: true
Since: 3.10.0