This code is based on the boids idea by craig reynolds. For more information visit https://www.red3d.com/cwr/boids/. The flocking behaviour of the boids tries to simulate the natural way fish or birds would move in groups. This simulation only needs three core rules: Alignment, cohesion and separation. You can adjust the sliders to change the impact of the corresponding rule to the simulation.
Steer towards the average heading of local flockmates.
Steer to move toward the average position of local flockmates.
Steer to avoid crowding local flockmates.