Click to play! It’s not polished, but it lets you explore different flocking behaviors. Here’s what the controls do:
- count The number of “birds” in the simulation.
- alignmentRadius Birds rotate to match the direction of their neighbors. This parameter changes how far away they can “see”. Larger values tend to align the entire flock; small values let the flock break apart.
- separationRadius Birds try to avoid colliding with nearby walls and other birds. They will turn and simultaneously hit the brakes. This number controls their stopping distance.
- peripheralVision Birds have a blind spot behind them. When this slider is maximized, the birds will have no blind spot, and will see 360 degrees.
- turnSpeed The speed at which birds turn.
- brakePedal Birds will slow down to avoid colliding. When this slider is minimized, the birds will never use their brakes.
- travelSpeed The top speed of the birds.
- Scatter and Randomize: Try them and see…
If you want access to the code, the SubVersion repository is open: http://dev.zacharcher.com/svn/flocking_test/