obstacleAvoidance
obstacleAvoidance(
pos,vel,obstacles,maxSpeed,maxSeeAhead):Vec2
Defined in: src/modules/steering/steering.ts:233
Steer laterally around the nearest circular obstacle blocking the agent’s
path. Projects each obstacle centre onto the heading ray and, for those
within maxSeeAhead whose perpendicular distance is inside their radius,
picks the closest one ahead and pushes away from it. Returns the zero vector
when nothing is threatening (or the agent is stationary, so there is no
heading to project). Blend with seek / pathFollowing via combine.
Parameters
Section titled “Parameters”obstacles
Section titled “obstacles”readonly CircleObstacle[]
maxSpeed
Section titled “maxSpeed”number
maxSeeAhead
Section titled “maxSeeAhead”number