Idle particle
Colliding this frame
Occupied grid cell
⚠ Couldn't load the 3D engineThree.js failed to load from the CDN. Check your connection and reload.
Hundreds of spheres bounce inside a box while the simulation indexes their positions into a uniform 3D grid every frame, so collision checks only ever look at the 27 cells around each particle instead of every other particle in the scene. A live counter tracks exactly how many distance checks the indexed grid performs versus how many brute-force O(n²) comparison would need at the same particle count, and a method switch lets you run true brute force to watch frame time and the comparison counter both spike as particle count grows — a direct, moving picture of why every serious physics engine, spatial database and collision system indexes its objects instead of scanning them all.