Flocking
Reynolds' boids: separation, alignment and cohesion together, and the pointer scares the flock. Finding the neighbors is the costly part: scanning the whole crowd costs n² distance checks, a spatial grid only looks at the nearby cells. Raise the count to 1,000 and switch between the two to see the time per frame.
- velocity
- desired velocity
- steering force