Containment

Containment is a form of Wall Following behaviour in which particles are contained within a volume shape. This type of behaviour can be useful to model situations such as fish swimming within a fishbowl or being caught within a fishing net for example.

Boids will move around their environment as normal, but if they detect a potential collision with a surface of the containing volume they will take corrective action to avoid it by choosing a new target projected away from the container’s surface normal.