Constructor
new PerceptionSystem(configopt)
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
config | Object | <optional> |
Classes
Methods
canHear(observer, target) → {boolean}
Checks if observer can hear target (within hearing/alert radius and emitting sound/alert).
Parameters:
| Name | Type | Description |
|---|---|---|
observer | Object | |
target | Object |
Returns:
- Type:
- boolean
canSee(observer, target, obstaclesopt) → {boolean}
Checks if observer can see target (in range, in cone, and LOS unobstructed).
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
observer | Object | ||
target | Object | ||
obstacles | Array | <optional> |
Returns:
- Type:
- boolean
hasLineOfSight(from, to, obstaclesopt) → {boolean}
Checks if line-of-sight from source to target is unobstructed by obstacles.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
from | Object | ||
to | Object | ||
obstacles | Array | <optional> |
Returns:
- Type:
- boolean
isAudibleCandidate(candidate) → {boolean}
Determines whether a candidate emits sound or alert signals.
Parameters:
| Name | Type | Description |
|---|---|---|
candidate | Object |
Returns:
- Type:
- boolean
isInFov(observer, target) → {boolean}
Checks if target is within observer's field of view (FOV) cone.
Parameters:
| Name | Type | Description |
|---|---|---|
observer | Object | |
target | Object |
Returns:
- Type:
- boolean
isInVisionRange(observer, target) → {boolean}
Checks if target is within observer's vision range.
Parameters:
| Name | Type | Description |
|---|---|---|
observer | Object | |
target | Object |
Returns:
- Type:
- boolean
observe(observer, candidates, obstaclesopt, optionsopt) → {Array}
Filters candidate entities, returning visible and audible candidates.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
observer | Object | ||
candidates | Array | ||
obstacles | Array | <optional> | |
options | Object | <optional> |
Returns:
- Type:
- Array