Simulation of the flocking behaviors of birds in unity
using the flocking algorithm, which it's based on three simple rules:
Separation
Avoid crowding neighbors.
Alignment
Steer towards the average heading of neighbors.
Cohesion
Steer towards the average position of neighbors.
if you are interested in how exactly the algorithm works, you can read more about it on https://en.wikipedia.org/wiki/Flocking_(behavior)