function steerForFollowPath (out, boid, path, loop=false) {
    const wayPoint = path.points[boid.steering.pathIndex]
    if (!wayPoint) {
        boid.steering.pathIndex = 0
        return
    }

    // do we really want sqaured?
    //const pathThresholdSq = boid.steering.pathThreshold * boid.steering.pathThreshold
    //if (vec2.squaredDistance(boid.transform.position, wayPoint) < pathThresholdSq) {
    if (vec2.distance(boid.transform.position, wayPoint) < boid.steering.pathThreshold) {
        if (boid.steering.pathIndex == path.pointCount - 1) {
            if (loop)
                boid.steering.pathIndex = 0
        } else {
            boid.steering.pathIndex++
        }
    }

    if (boid.steering.pathIndex >= path.pointCount - 1 && !loop)
        steerForArrival(out, boid, wayPoint)
    else
        steerForSeek(out, boid, wayPoint)

    return out
}
// follow a path made up of an array or vectors
follow a path made up of an array or vectors
follow a path made up of an array or vectors
function steerForFollowPath (out, boid, path, loop=false) {
    const wayPoint = path.points[boid.steering.pathIndex]
    if (!wayPoint) {
        boid.steering.pathIndex = 0
        return
    }
    if (vec2.distance(boid.transform.position, wayPoint) < boid.steering.pathThreshold) {
        if (boid.steering.pathIndex == path.pointCount - 1) {
            if (loop)
                boid.steering.pathIndex = 0
        } else {
            boid.steering.pathIndex++
        }
    }
    if (boid.steering.pathIndex >= path.pointCount - 1 && !loop)
        steerForArrival(out, boid, wayPoint)
    else
        steerForSeek(out, boid, wayPoint)
    return out
}
function steerForFollowPath ( out , boid , path , loop = false ) { const wayPoint = path . points [ boid . steering . pathIndex ] if ( ! wayPoint ) { boid . steering . pathIndex = 0 return } if ( vec2 . distance ( boid . transform . position , wayPoint ) < boid . steering . pathThreshold ) { if ( boid . steering . pathIndex == path . pointCount - 1 ) { if ( loop ) boid . steering . pathIndex = 0 } else { boid . steering . pathIndex ++ } } if ( boid . steering . pathIndex >= path . pointCount - 1 && ! loop ) steerForArrival ( out , boid , wayPoint ) else steerForSeek ( out , boid , wayPoint ) return out }
follow a path made up of an array or vectors
follow a path made up of an array or vectors
// do we really want sqaured? //const pathThresholdSq = boid.steering.pathThreshold * boid.steering.pathThreshold //if (vec2.squaredDistance(boid.transform.position, wayPoint) < pathThresholdSq) {