# Sandbox.Npcs.Layers.SensesLayer

Environmental awareness and target detection for an NPC. Disabling the layer clears its results.

- Kind: class
- Namespace: `Sandbox.Npcs.Layers`
- Assembly: `Sandbox.Engine`
- Inherits: [Sandbox.Npcs.Layers.BaseNpcLayer](/api/Sandbox.Npcs.Layers.BaseNpcLayer)

## Constructors

- [`SensesLayer`](/api/Sandbox.Npcs.Layers.SensesLayer/.ctor)

## Properties

- [`Disturbance`](/api/Sandbox.Npcs.Layers.SensesLayer/Disturbance): The nearest disturbance (gunshot, death, etc.) this NPC currently senses, if any.
- [`FieldOfView`](/api/Sandbox.Npcs.Layers.SensesLayer/FieldOfView): Total horizontal field of view in degrees. Targets outside this cone aren't seen (they can still be heard, or noticed if they're right next to the NPC).
- [`HearingRange`](/api/Sandbox.Npcs.Layers.SensesLayer/HearingRange): How far the NPC can hear.
- [`QuietSpeed`](/api/Sandbox.Npcs.Layers.SensesLayer/QuietSpeed): Hostiles moving slower than this can't be heard -- creep (crouch-walk) to sneak up on someone.
- [`SightRange`](/api/Sandbox.Npcs.Layers.SensesLayer/SightRange): How far the NPC can see.
- [`Targets`](/api/Sandbox.Npcs.Layers.SensesLayer/Targets): Which agents the NPC scans for. This is just the broad-phase filter -- disposition decides who counts as hostile.
- [`VisibleHostiles`](/api/Sandbox.Npcs.Layers.SensesLayer/VisibleHostiles): Visible entities this NPC is disposed Hostile toward.
- [`VisibleThreats`](/api/Sandbox.Npcs.Layers.SensesLayer/VisibleThreats): Visible entities this NPC is disposed Fearful toward (things to flee from).

## Methods

- [`FindBestTarget`](/api/Sandbox.Npcs.Layers.SensesLayer/FindBestTarget): Find the visible hostile this NPC should engage first: highest relationship priority, nearest breaking ties.
- [`FindNearestVisible`](/api/Sandbox.Npcs.Layers.SensesLayer/FindNearestVisible): Find the nearest visible object with a specific tag. May perform visibility traces for unchecked candidates.
- [`GetPushingPlayer`](/api/Sandbox.Npcs.Layers.SensesLayer/GetPushingPlayer): A player inside our personal space who was moving toward us at the last scan -- they're trying to get past and we're in their way. Returns null when nobody is barging in.
