autumn ball pit black hole boids bubbles chladni plate cloth dog fireflies fireworks fish pond grass gravitational lensing hot air balloon lightning tree lorenz attractor magnet bar magnet horseshoe meteor shower murmuration neurons newtons cradle pendulum chain sheepdog slime mold snake snowflake solar system submarine sun attraction water box water ripple
move, click, tap
random
crsor  /  all sims  /  boids

Boids — flocking simulation

Reynolds 1987 boids — separation, alignment, cohesion — running on a spatial hash grid. Cursor attracts the flock; click repels. Torus wraparound.

How it works

Boids — Reynolds 1987.

Three forces: separation (r=14), alignment + cohesion (r=34). Spatial hash grid, cell size = perception radius, neighbor scan is O(n) amortized.

Cursor attracts within 220px, repels on click. Linear falloff. Count = min(1400, area/1200). Torus wraparound.

Related simulations

Categories: Life & nature.