Cohesion
Makes entities go towards their neighbors.
CohesionJob
Internally, the behavior calculates a weighted centroid of it's neigbhors positions. The weight of each neighbor is higher the closer it is and the more it is directly in front of the entity. The behavior gives direction to the centroid and possibly makes the entity speed up to catch up to its neighbors. The strength of the behavior grows larger the further away the weighted centroid is.
This behavior outputs the following:
DesiredDirection- Direction to a weighted centroid of neighbors position.DirectionDesire- FromMinActivation * DirectionStrengthtoDirectionStrengthas distance to the weighted centroid goes from0toMaxDistance.DesiredSpeed- FromMinSpeedtoMaxSpeedas distance to the weighted centroid goes from0toMaxDistance.SpeedDesire- FromMinActivation * SpeedStrengthtoSpeedStrengthas distance to the weighted centroid goes from0toMaxDistance.Priority-Priority(constant)
CohesionComponent
The main interesting properties to adjust on CohesionComponent are:
- Observability
DistanceP- Power for shaping the influence of each neighbor based on distance.StartAngle- Above this angle a neighbor's influence on the centroid starts to decrease, below it it's at maximum.AngleP- Power for shaping the influence of each neighbor based on angle.
- Activation
ActivationP- Power for shaping the interpolation ofDirectionDesire.MinActivation- The minimumDirectionDesirereturned willMinActivation * DirectionStrength.MinSpeed- The minimum desired speed to catch up with neighbors.
BaseDataMaxDistance- Maximum distance where neighbors will be detected.MaxAngle- Maximum field of view angle where neighbors will be detected.DirectionStrength- MultipliesDirectionDesire.SpeedStrength- MultipliesSpeedDesire.Priority- Priority.