steerkit Reynolds' steering behaviors, small and engine-agnostic

Aquarium

A school of fish in a Three.js tank: flocking on a spatial grid, around the rocks, inside the glass. The shark hunts a fish every few seconds; near it, fish panic, faster and more agile, scatter, then regroup as their extra speed fades out (overspeedDamping). steerkit/three draws them: setInstances writes the whole school into one instanced mesh, faceVelocity turns the shark smoothly toward its way, and a SteeringHelper draws the forces, the rocks as the fish see them and the shark's reach.

  • velocity
  • desired velocity
  • steering force

TypeScript