Dealing with a wide range of object sizes is the biggest difficulty since each object has search out to the range of the largest object it might touch. When the objects are the same size, you can set the grid spacing to the object diameter and only need to check 2x2 cells, but with bigger objects in the mix, you have to search wider. This can be helped by sorting the objects by size and entering them from smallest to largest, so each object only has to test out to the range of its own diameter.
Although I have used simple flat grids before I haven’t done any performance comparisons.
My main reason for doing this was to create the visual simulation of a quadtree at work and along the way enhance my knowledge of Javascript and TypeScript.
I don’t know why the pane tab and button are distorted when run in this forum if anyone has an idea please let me know.