Flock
Particles move together as a flock of birds or a school of fish: keeping apart, heading the same way, staying together, and turning aside from what's ahead.
Particles move together as a flock or a school: each keeps apart from the nearest few it sees, heads their way and keeps among them, cruising at its speed (with those of other events with this operator too). They turn aside from this event's Collide objects and ground before reaching them.
- Add it
- EventAdd OperatorPhysicsFlock
- Sends on
- Nothing: it has no wire.
- Influence
- No: a value can’t weigh it.
When to use it
Birds, fish, bats, bees, a murmuration of starlings, a shoal swerving round a rock. Each particle steers by the nearest few it can see, so a flock of fifty and one of fifty thousand behave alike.
It works across events: particles flock with those of every event with Flock.
Set it up
Birth the flock in a box or volume, with 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.
Show them as birds or fish: a Shapes collection on the Display panel, and a Rotation Along Motion with Keep Doing It and a little Bank.
Give them things to swerve round with a Collide: they turn aside before reaching its objects and ground.
Settings
As the flow editor’s sidebar shows them. Changing any of them marks the bake old; those marked Keyframable can also change through a bake.
How hard they can turn, speed up or slow down. What matters most comes first: turning aside from what is ahead, then keeping apart, then the rest.
How many of the nearest it sees each one follows. A starling watches about seven, so a flock behaves the same however big it gets.
How far round each one sees, ahead and to the sides. Others in the gap behind it are unseen.
How far apart they keep, from each other and from what they look out for.
How far ahead, in seconds, they look out for this event's Collide objects and ground, to turn aside before reaching them. 0 never.
How each one decides
Each particle sees the nearest Follow others within Sight, in front of it within View. It then steers, most urgent first, as hard as Steering allows:
- turning aside from the event's colliders and ground, Look Ahead seconds ahead;
- keeping apart from any nearer than Spacing (Separation);
- heading the way the others head, at their speed (Alignment);
- moving toward the middle of them (Cohesion), and keeping level (Keep Level);
- coming back to Cruise Speed.
Separation, Alignment, Cohesion and Keep Level are weights: raise one to make it count more. Cohesion 0 lets the flock drift apart; Keep Level near 1 keeps fish swimming flat.
Works with
- Other forces add on top: a Swirl sends a school round in a ring, a negative Attract on a shark makes them flee it.
- Rotation Along Motion, Keep Doing It and Bank, to face where they go and lean into turns.
- An event takes one Flock, and can't also hold a Liquid, Follow Curve or Goal.
Problems you may see
event: operator: an event takes only one
Errors stop a bake; warnings don’t. Every message is on the Messages page.
Related
Particle Force
Particles pull each other within a reach, or push apart with a negative strength: clumping goo, blobs, swarms that cluster or spread evenly.
Bind
Hold particles together: cloth, ropes, soft bodies, sticky goo and things that tear; and hold rigid bodies on joints, or glue them into something to smash.