src/boid.js
function wander() {
        const center = velocity.clone().normalize().scaleBy(wanderDistance);

        const offset = Vec2.get();
        offset.set(wanderAngle, wanderRadius);
        // offset.length = wanderRadius;
        // offset.angle = wanderAngle;
        wanderAngle += Math.random() * wanderRange - wanderRange * 0.5;

        const force = center.add(offset);
        steeringForce.add(force);

        offset.dispose();
        force.dispose();

        return boid;
    }
function wander() {
        const center = velocity.clone().normalize().scaleBy(wanderDistance);

        const offset = Vec2.get();
        offset.set(wanderAngle, wanderRadius);
        // offset.length = wanderRadius;
        // offset.angle = wanderAngle;
        wanderAngle += Math.random() * wanderRange - wanderRange * 0.5;

        const force = center.add(offset);
        steeringForce.add(force);

        offset.dispose();
        force.dispose();

        return boid;
    }
function wander ( ) { const center = velocity . clone ( ) . normalize ( ) . scaleBy ( wanderDistance ) ; const offset = Vec2 . get ( ) ; offset . set ( wanderAngle , wanderRadius ) ; // offset.length = wanderRadius; // offset.angle = wanderAngle; wanderAngle += Math . random ( ) * wanderRange - wanderRange * 0.5 ; const force = center . add ( offset ) ; steeringForce . add ( force ) ; offset . dispose ( ) ; force . dispose ( ) ; return boid ; }
wander around, changing angle by a limited amount each tick
wander around changing angle by a limited amount each tick