Skip to content

five-on-it / packages/ai/src/perception / lineOfSight

Function: lineOfSight() ​

lineOfSight(sim, npc, target, p): boolean

Defined in: packages/ai/src/perception.ts:70

Whether npc has target in sight, alive or not: within the profile's range (shortened by the dark and the weather, visibility.ts) and view cone, with nothing between the npc's eyes and the target's centre (its car's when seated). A chaser keeps watching the target it brought down this way.

Parameters ​

sim ​

SimWorld

npc ​

number

target ​

number

p ​

BehaviourProfile

Returns ​

boolean