Create a flocking plugin for ECSpresso.
Installs two systems:
flocking-forces
flocking-heading
Requires the transform, physics2D, and spatial-index plugins to be installed.
Optional
const ecs = ECSpresso.create() .withPlugin(createRenderer2DPlugin({ background: '#0a0a2e' })) .withPlugin(createPhysics2DPlugin()) .withPlugin(createSpatialIndexPlugin()) .withPlugin(createFlockingPlugin()) .build(); Copy
const ecs = ECSpresso.create() .withPlugin(createRenderer2DPlugin({ background: '#0a0a2e' })) .withPlugin(createPhysics2DPlugin()) .withPlugin(createSpatialIndexPlugin()) .withPlugin(createFlockingPlugin()) .build();
Create a flocking plugin for ECSpresso.
Installs two systems:
flocking-forces— computes separation/alignment/cohesion and applies via applyForce()flocking-heading— clamps speed to maxSpeed and orients rotation to match velocityRequires the transform, physics2D, and spatial-index plugins to be installed.