Flocks and schools
Birds, fish and swarms that steer together: Flock's settings one by one, swerving round obstacles, keeping level, and shapes that face where they go.
A flock is many particles each steering by the few nearest it can see: keep apart, head the same way, stay together. Nobody leads, and the flock's shape comes from that alone, much as starlings and fish do it.
Start from
The Swarm starter is a flock of paper darts following a leader. Or start from the Particles starter and press Convert to Flow, or a new empty flow: a flock needs only a few operators.
The flow
Birth them All at Once in a Position Volume, the space the flock starts in. A little Speed and Spread, so they don't all start the same way.
Add Flock. Set Cruise Speed to how fast they go, and Spacing to how far apart they keep.
In the Display panel, set Shapes to a collection holding the bird or fish, modelled pointing along one axis.
Add a Rotation Along Motion, with that Axis, Keep Doing It on and a little Bank: they face where they go and lean into their turns.
Add a Collide with what they should swerve round: they turn aside before they reach it.
Flock's settings, one by one
Each particle sees the nearest Follow others within Sight, in front of it within View, and steers as hard as Steering allows, the most urgent first:
| Setting | What it does | Try |
|---|---|---|
| Cruise Speed | The speed they come back to | Birds 5 to 10 m/s, fish 1 to 2 |
| Steering | How hard they can turn and change speed. Low swings in wide arcs; high darts | 5 to 20 m/s² |
| Sight | How far each sees the others | A few times Spacing |
| Follow | How many of the nearest it follows. A starling watches about seven, so a flock acts the same however big | 6 to 10 |
| View | How far round it sees; others in the gap behind it are unseen | 270° |
| Spacing | How far apart they keep, and from what they look out for | A body length or two |
| Separation | How much they keep apart | 1; more for loose swarms |
| Alignment | How much they head the way the others head | 1; more for orderly schools |
| Cohesion | How much they keep among the others. 0 lets the flock drift apart | 1; more for tight balls |
| Keep Level | How much they keep level, neither climbing nor diving | 0 for birds, near 1 for fish |
| Look Ahead | How far ahead, in seconds, they look out for colliders and the ground | 1 s; more for fast flocks |
Shaping the flock
The flock wanders by itself. To steer it as a whole, add forces to the event; Flock adds its steering on top:
- a Swirl round an object sends a school circling in a ring, a bait ball;
- an Attract toward a moving empty leads the flock along, as if it were following food;
- a negative Attract on a predator, with a Reach, makes them scatter from it and close up again behind.
What goes wrong
- They clump into a tight ball. Separation too low, or Spacing too small for their size.
- They fly through an obstacle. Look Ahead too short for their speed, or the obstacle isn't in this event's Collide.
- The shapes fly sideways. The Rotation's Axis isn't the one the model points along. Check it in the shape's own object, unrotated.
- Fish pitch up and down. Raise Keep Level.
- They jitter. Steering too high with a small Spacing: they correct too hard. Lower Steering, or raise Spacing.
Related
Particles that pile up: sand and grains
Particles that take up room: sand pouring into a heap, gravel, beads, a ball pit. Without a flow, or with Particle Physics in one.
Following curves and forming shapes
Particles that run along a path, spiral round it, and fly in to form a logo, a word or a mesh, on cue; a logo reveal start to finish.