Skip to content

five-on-it / packages/ai/src/steer-foot / avoidObstacles

Function: avoidObstacles() ​

avoidObstacles(ai, npc, dx, dz, ignore): object

Defined in: packages/ai/src/steer-foot.ts:131

Steers a heading around whatever three rays find within reach: a hit near on the middle ray turns the character toward the freer side; with both sides shut too it is blocked. The character's own body and ignore (its target, or the target's car) do not count.

Parameters ​

ai ​

AiWorld

npc ​

NpcState

dx ​

number

dz ​

number

ignore ​

number

Returns ​

object

blocked ​

blocked: boolean

dx ​

dx: number

dz ​

dz: number