Collision Detection using Spatial Hashing

I have found a great YouTube channel Ten Minute Physic and in particular this video on the spatial hashing algorithm. The sketch below is based on the algorithms described in this video.

Although I have not performed any serious performance tests it appears to be of the same order of magnitude as a quadtree implementation but has a much simpler code implementation.

The full sketch code is available in the p5js web editor. If you use the p5js editor to create a copy make sure you turn off “Loop Protection" for best performance.

This reply was deleted by Quark