The primary simulation function takes the calculated vectors for each behavior and adds it to a single steering vector. This steering vector updates the rotation of each individual boid based on its result.
The alignment function iterates through the list of boids in the scene and checks the distance between each boid, these values are stores in a separate list. If a specific distance value is less than the LocalRange, it will point towards the average forward vector of its mates.
The cohesion function iterates through the list of boids in the scene and checks the distance between each boid, these values are stores in a separate list. If a specific distance value is less than the LocalRange, it calculates the average vector position and adjust the cohesion vector towards that position. The larger the LocalRange value the larger the group will be, the larger area each boid influences one another.
The separation function iterates through the list of boids in the scene and checks the distance between each boid, these values are stores in a separate list. If a specific distance value is less than the LocalAvoidanceRange, it calculates the average vector position and adjusts the separation vector to be inverted. The lower the LocalAvoidanceRange the denser the group will be.
The leadership function iterates through the list of boids in the scene and checks the distance between each boid, these values are stores in a separate leadership distance list. These values are sorted in ascending order and the boid with the smallest distance relative to the current boid is assumed to be the leader. This directly influences the steering force of the current boid.
Back to Top