rex_boids
Plugin, ACE table, Discussion thread
Dependence: None
Dependence: None
Introduction
Calculate steer force by flocking algorithm.
Calculate steer force by flocking algorithm.
- Cohesion: Stay close to the centre of the flock
- Alignment: Head in the same direction of the flock
- Separation: Avoid collisions with flock
Usage
Sample capx
Sample capx
Follows these steps to get steer force.
- Call "Action:Clean" to clean steer force to 0.
- Calculate steer force by "Action:Cohesion", "Action:Alignment", "Action:Separation". Parameter "Neighbors" might be picked by official line-of-sight behavior.
- Check if the result of steer force is not 0 by "Condition:Has force".
- If there has steer force, get this force by "Expression:ForceAngle" and "Expression:ForceMagnitude" in polar axis, or (Expression:ForceDx, Expression:ForceDy ) in orthogonal axis. Use these info to control sprite like rotate the instance to this angle.
Avoid obstacles
"Action:Separation" could be used to avoid obstacles by put the obstacles in parameter "Neighbors".
"Action:Separation" could be used to avoid obstacles by put the obstacles in parameter "Neighbors".
Apply force directly
Call "Action:Apply force towards position" or "Action:Apply force at angle" to apply steer force directly.
Call "Action:Apply force towards position" or "Action:Apply force at angle" to apply steer force directly.