pixi-spatial-hash
This package provides an 2D spatial hash implementation. You can use the spatial-hash as standalone or as a system on your renderer.
Standalone usage
If you do not need to hash your entire scene graph, then using a standalone object that is infrequently updated is ideal. This is especially true if you do not render on each tick.
; ;; // HINT: Setup your particle container with particles!!!
Spatial-hash system usage
If you need a spatial hash over the whole scene graph updated each tick, then the spatial-hash system is the ideal method:
;; ; document.body.appendChildapp.view; app.renderer.addSystemSpatialHashSystem, "spatialHash"; // Install the SpatialHashSystemapp.renderer.spatialHash.addTargetapp.stage; // Register app.stage as a hashed-target // Optional: Use a Ticker to update the spatial hash each frame instead. By default, the spatial hash is// updated on each render call.app.renderer.spatialHash.setTickerapp.ticker; // Optional-2: Update the spatial-hash right now! You can then search for any display-objects intersecting with a display-object// or rectangle bounds.app.renderer.spatialHash.update;app.renderer.searchdisplayObject;