# Behavior : Boids

Author:Rex.Rainbow

• Calculate steer force by flocking algorithm.

## Force - clean

### Action:Clean

• Clean output force to 0.

## Force - flocking

### Action:Cohesion

• Add cohesion force which remaining close to the centre of neighbors.
• Neighbors ( object ) : Object of neighbors
• Distance ( number ) : Cohesion distance, in pixels, to normalize the cohesion force.
• weight ( number ) : Weight of cohesion force.

### Action:Alignment

• Add alignment force which aligning to the average direction of neighbors.
• Neighbors ( object ) : Object of neighbors
• weight ( number ) : Weight of alignment force.

### Action:Separation

• Add separation force which retaining separation from close neighbours.
• Neighbors ( object ) : Object of neighbors
• Distance ( number ) : Separation distance, in pixels, to normalize the separation force.
• weight ( number ) : Weight of separation force.

## Forces

### Action:Apply force towards position

• Apply a force towards a position.
• X ( number ) : The X co-ordinate to apply the force towards.
• Y ( number ) : The Y co-ordinate to apply the force towards.
• Force ( number ) : The force to apply.

### Action:Apply force at angle

• Apply a force in a particular direction.
• Angle ( number ) : The angle, in degrees, to apply the force towards.
• Force ( number ) : The force to apply.

## Output

### Expression:ForceAngle

• Get angle of total attracting force.

### Expression:ForceMagnitude

• Get magnitude of total attracting force.

### Expression:ForceDx

• Get dx of total attracting force.

### Expression:ForceDy

• Get dy of total attracting force.

## Output - alignment

### Expression:LastAlignmentAngle

• Get last angle of alignment.

## Output - cohesion

### Expression:LastCohesionX

• Get last position X of cohesion.

### Expression:LastCohesionY

• Get last position Y of cohesion.

## Output

#### Condition:Has force

• Return true if force is not 0.