Hold key "1" or "2" or nothing Hold key "s" before clicking the green flag to see a sample project, which uses this tool kit. It's inefficient here (also due to broadcasts having delay only on Scratch), but on Turbowarp I prepared much bigger simulation which easily outperforms brute force search As you can see, the effectiveness of the algorithm can be different under varying environments, situations, chosen variables The collisions function checks Axis-Aligned-bounding-Boxes collision detection against collision candidates, so you don't need to take care of it. All lists from the BVH-Tree main function can be joined into one list, but I honestly prefer it this way. no deleting, no inserting, no "item of "value" in list" blocks used.
k*nlog(n) complexity (k is equal to 8 for now, can be smaller, but I prefer cleaner code instead) My BVH-Tree chooses which axis to subdivide instead of interchanging them. I still don't know how to find better split coordinate (instead of just median) in O(n) time