Alignment
Makes entities align their velocity with their neighbors' velocities.
AlignmentJob
Internally, the behavior calculates a weighted average of it's neigbhors directions and speeds. 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 the weighted average direction and weighted average speed. The strength of the behavior grows larger the further the direction and speed are from the averages.
This behavior outputs the following:
DesiredDirection- Weighted average direction of neighbors' velocity.DirectionDesire- FromMinAngleWeight * DirectionStrengthtoDirectionStrengthas angle between current direction andDesiredDirectiongoes fromStartActivationAngleto360degress.DesiredSpeed- Weighted average speed of neighbors' velocity.SpeedDesire- FromMinSpeedDiffWeight * SpeedStrengthtoSpeedStrengthas difference between the average speed and current speed divided byMaxSpeedgoes fromStartSpeedDiffFractionto1.Priority-Priority(constant)
AlignmentComponent
The main interesting properties to adjust on AlignmentComponent 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.
- Direction Activation
AngleActivationP- Power for shaping the interpolation ofDirectionDesire.MinAngleWeight- The minimumDirectionDesirereturned willMinAngleWeight * DirectionStrength.StartActivationAngle- Above this angle between entity's direction and the weighted average direction theDirectionDesirestarts increase, below it it'sMinAngleWeight * DirectionStrength.
- Speed Activation
SpeedDiffActivationP- Power for shaping the interpolation ofSpeedDesire.MinSpeedDiffWeight- The minimumSpeedDesirereturned will beMinSpeedDiffWeight * SpeedStrength.StartSpeedDiffFraction- The minimum difference between the average speed and current speed divided byMaxSpeedafter which theSpeedDesirestarts to increase aboveMinSpeedDiffWeight * SpeedStrength.
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.