Flocking System Breakdown

Flocking Systems | Boids | Geometric Flight | Flocking Behaviour | Collision Avoidance | Velocity Matching | Flock Centring | Examples | Steering Behaviours | Seek and Flee | Pursuit and Evasion | Arrival | Wander | Path Following | Wall Following and Containment

Arrival

While the boid is far from its target, arrival is identical to seek. But instead of moving through the target at full speed, as it would do using just seek, arrival causes the character to slow down as it approaches the target, eventually slowing down to stop coincident with it. The threshold distance at which the boid should slow is a parameter of the behaviour, as so is decided by the programmer.

The following pseudo code demonstrates one version of this algorithm:



target_offset = target – position;
distance = length(target_offset);
ramped_speed = max_speed * (distance / slowing_distance);
clipped_speed = minimum(ramped_speed, max_speed);
desired_velocity = (clipped_speed / distance) * target_offset;
steering = desired_velocity – velocity;




This algorithm determines whether the boid is inside or outside of the stopping radius (slowing_distance). If outside this radius, the desired velocity is clipped to max_speed to maintain the seek behaviour. If the boid is inside the stopping radius, the desired velocity is ramped down to zero by some ramping function.

 

 

 

 

 

 

<< previous | next >>