SenseResult
Defined in: ai/perception/sense.ts:14
sense.ts
Line-of-sight / field-of-view sensing — pure geometry, unit-testable.
senseTarget combines a range check, a cone (field-of-view) check, and an
optional occlusion callback (isBlocked, backed by a physics raycast in the
engine, a fake in tests) so the core stays free of any physics/wasm type. The
engine’s perception system writes the result to a Perception component that
FSM conditions / BT leaves read via ctx.get(Perception).
Properties
Section titled “Properties”dirX:
number
Defined in: ai/perception/sense.ts:20
Unit direction observer→target, or (0,0) when not visible.
dirY:
number
Defined in: ai/perception/sense.ts:21
distance
Section titled “distance”distance:
number
Defined in: ai/perception/sense.ts:18
Distance to the target (always set, even when not visible).
visible
Section titled “visible”visible:
boolean
Defined in: ai/perception/sense.ts:16
Target is within range, inside the cone, and not occluded.