Skip to content

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.

Vec2

Vec2

readonly CircleObstacle[]

number

number

Vec2