We implemented simple BOID algorithm to simulate behavior of Animals flocking.
BOID algorithm consists of three simple steering behaviors:
SEPARATION – steer to avoid crowding local flock-mates
ALIGNMENT – steer towards the average heading of local flock-mates
COHESION – steer to move toward the average position of local flock-mates
Image source: http://www.red3d.com/cwr/boids/
Each agent in simulation is GameObject with BoidAgent scripts attached to it. Script has some public parameters for tweaking and testing different parameters.
Hope this helps somehow! 🙂 If you have any questions don’t hesitate to ask in comments!