Navigation
API > API/Runtime > API/Runtime/AIModule > API/Runtime/AIModule/Perception
Inheritance Hierarchy
- UActorComponent
- UPawnSensingComponent
References
| Module | AIModule |
| Header | /Engine/Source/Runtime/AIModule/Classes/Perception/PawnSensingComponent.h |
| Include | #include "Perception/PawnSensingComponent.h" |
Syntax
UCLASS (ClassGroup=AI, HideCategories=(Activation, "Components|Activation", Collision),
Meta=(BlueprintSpawnableComponent), MinimalAPI)
class UPawnSensingComponent : public UActorComponent
Remarks
SensingComponent encapsulates sensory (ie sight and hearing) settings and functionality for an Actor, allowing the actor to see/hear Pawns in the world. It does nothing on network clients.
Variables
| Type | Name | Description | |
|---|---|---|---|
| uint32: 1 | bEnableSensingUpdates | If true, component will perform sensing updates. | |
| uint32: 1 | bHearNoises | If true, we will perform audibility tests and will be notified when a Pawn makes a noise that can be heard. | |
| uint32: 1 | bOnlySensePlayers | If true, will only sense player-controlled pawns in the world. Default: true | |
| uint32: 1 | bSeePawns | If true, we will perform visibility tests and will trigger notifications when a Pawn is visible. | |
| float | HearingMaxSoundAge | Max age of sounds we can hear. Should be greater than SensingInterval, or you might miss hearing some sounds! | |
| float | HearingThreshold | Max distance at which a makenoise(1.0) loudness sound can be heard, regardless of occlusion | |
| float | LOSHearingThreshold | Max distance at which a makenoise(1.0) loudness sound can be heard if unoccluded (LOSHearingThreshold should be > HearingThreshold) | |
| FHearNoiseDelegate | OnHearNoise | Delegate to execute when we hear a noise from a Pawn's PawnNoiseEmitterComponent. | |
| FSeePawnDelegate | OnSeePawn | Delegate to execute when we see a Pawn. | |
| float | PeripheralVisionAngle | How far to the side AI can see, in degrees. | |
| float | PeripheralVisionCosine | Cosine of limits of peripheral vision. Computed from PeripheralVisionAngle. | |
| float | SensingInterval | Amount of time between pawn sensing updates. | |
| float | SightRadius | Maximum sight distance. | |
| FTimerHandle | TimerHandle_OnTimer | Handle for efficient management of OnTimer timer |
Constructors
| Type | Name | Description | |
|---|---|---|---|
UPawnSensingComponent
(
const FObjectInitializer& ObjectInitializer |
Functions
| Type | Name | Description | |
|---|---|---|---|
| void | BroadcastOnHearLocalNoise
(
APawn& Instigator, |
Broadcasts notification that our sensor hears a noise made local to a Pawn's position, using the OnHearNoise delegates. | |
| void | BroadcastOnHearRemoteNoise
(
APawn& Instigator, |
Broadcasts notification that our sensor hears a noise made remotely from a Pawn's position, using the OnHearNoise delegates. | |
| void | BroadcastOnSeePawn
(
APawn& Pawn |
Broadcasts notification that our sensor sees a Pawn, using the OnSeePawn delegates. | |
| bool | CanHear
(
const FVector& NoiseLoc, |
@Returns true if sensor can hear this noise. | |
| bool | Are we capable of sensing anything (and do we have any callbacks that care about sensing)? If so UpdateAISensing() will be called every sensing interval. | ||
| bool | CouldSeePawn
(
const APawn* Other, |
Chance of seeing other pawn decreases with increasing distance or angle in peripheral vision | |
| float | |||
| float | |||
| AActor * | |||
| AController * | |||
| FVector | Get position where hearing/seeing occurs (i.e. ear/eye position). | ||
| FRotator | Get the rotation of this sensor. We need this for the sight component | ||
| bool | HasLineOfSightTo
(
const AActor* Other |
Check line to other actor. | |
| void | |||
| bool | IsNoiseRelevant
(
const APawn& Pawn, |
Test whether the noise is loud enough and recent enough to care about. | |
| bool | IsSensorActor
(
const AActor* Actor |
Is the given actor our owner? Used to ensure that we are not trying to sense our self / our owner. | |
| void | OnTimer () |
Update function called on timer intervals. | |
| void | SensePawn
(
APawn& Pawn |
See if there are interesting sounds and sights that we want to detect, and respond to them if so. | |
| void | SetPeripheralVisionAngle
(
const float NewPeripheralVisionAngle |
Sets PeripheralVisionAngle. Calculates PeripheralVisionCosine from PeripheralVisionAngle | |
| void | SetSensingInterval
(
const float NewSensingInterval |
Changes the SensingInterval. | |
| void | SetSensingUpdatesEnabled
(
const bool bEnabled |
Enables or disables sensing updates. The timer is reset in either case. | |
| void | SetTimer
(
const float TimeDelay |
Modify the timer to fire in TimeDelay seconds. A value <= 0 disables the timer. | |
| bool | ShouldCheckAudibilityOf
(
APawn* Pawn |
Returns true if we should check whether we can hear the given Pawn (because we are able to hear, and the Pawn has the correct team relationship to us) | |
| bool | ShouldCheckVisibilityOf
(
APawn* Pawn |
Returns true if we should check whether the given Pawn is visible (because we can see things, the Pawn is not hidden, and if the Pawn is a player and we only see players) | |
| void | Calls SensePawn on any Pawns that we are allowed to sense. |
Classes
| Type | Name | Description | |
|---|---|---|---|
| FHearNoiseDelegate | |||
| FSeePawnDelegate |