The cohese force applies a force to steer an agent towards the average position of its neighbors. This gives the effect of groups of agents that cohese with each other, forming larger and larger groups as they draw in nearby agents who may be in groups themselves. The size of the groups largely depends on the size of the vision radius of the agents. The agent will look around for other agents within its vision radius, compute a center of mass, and seek that target.
Cohesion steering behavior gives an character the ability to cohere with (approach and form a group with) other nearby characters. See Figure 15. Steering for cohesion can be computed by finding all characters in the local neighborhood (as described above for separation), computing the “average position” (or “center of gravity”) of the nearby characters. The steering force can applied in the direction of that “average position” (subtracting our character position from the average position, as in the original boids model), or it can be used as the target for seek steering behavior.