Navigation
API > API/Runtime > API/Runtime/AIModule
| Name | UPawnSensingComponent |
| Type | class |
| Header File | /Engine/Source/Runtime/AIModule/Classes/Perception/PawnSensingComponent.h |
| Include Path | #include "Perception/PawnSensingComponent.h" |
Syntax
UCLASS (ClassGroup=AI, HideCategories=(Activation, "Components|Activation", Collision),
Meta=(BlueprintSpawnableComponent), MinimalAPI)
class UPawnSensingComponent : public UActorComponent
Inheritance Hierarchy
- UObjectBase → UObjectBaseUtility → UObject → UActorComponent → UPawnSensingComponent
Implements Interfaces
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
UPawnSensingComponent
(
const FObjectInitializer& ObjectInitializer |
Perception/PawnSensingComponent.h |
Classes
| Name | Remarks |
|---|---|
| FHearNoiseDelegate | |
| FSeePawnDelegate |
Variables
Public
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| bEnableSensingUpdates | uint32 | If true, component will perform sensing updates. | Perception/PawnSensingComponent.h |
|
| bHearNoises | uint32 | If true, we will perform audibility tests and will be notified when a Pawn makes a noise that can be heard. | Perception/PawnSensingComponent.h |
|
| bOnlySensePlayers | uint32 | If true, will only sense player-controlled pawns in the world. Default: true | Perception/PawnSensingComponent.h |
|
| bSeePawns | uint32 | If true, we will perform visibility tests and will trigger notifications when a Pawn is visible. | Perception/PawnSensingComponent.h |
|
| HearingMaxSoundAge | float | Max age of sounds we can hear. Should be greater than SensingInterval, or you might miss hearing some sounds! | Perception/PawnSensingComponent.h |
|
| HearingThreshold | float | Max distance at which a makenoise(1.0) loudness sound can be heard, regardless of occlusion | Perception/PawnSensingComponent.h |
|
| LOSHearingThreshold | float | Max distance at which a makenoise(1.0) loudness sound can be heard if unoccluded (LOSHearingThreshold should be > HearingThreshold) | Perception/PawnSensingComponent.h |
|
| OnHearNoise | FHearNoiseDelegate | Delegate to execute when we hear a noise from a Pawn's PawnNoiseEmitterComponent. | Perception/PawnSensingComponent.h |
|
| OnSeePawn | FSeePawnDelegate | Delegate to execute when we see a Pawn. | Perception/PawnSensingComponent.h |
|
| SensingInterval | float | Amount of time between pawn sensing updates. | Perception/PawnSensingComponent.h |
|
| SightRadius | float | Maximum sight distance. | Perception/PawnSensingComponent.h |
|
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual bool CanHear
(
const FVector& NoiseLoc, |
@Returns true if sensor can hear this noise. | Perception/PawnSensingComponent.h | |
virtual bool CanSenseAnything() |
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. | Perception/PawnSensingComponent.h | |
virtual bool CouldSeePawn
(
const APawn* Other, |
Chance of seeing other pawn decreases with increasing distance or angle in peripheral vision | Perception/PawnSensingComponent.h | |
float GetPeripheralVisionAngle() |
Perception/PawnSensingComponent.h |
|
|
float GetPeripheralVisionCosine() |
Perception/PawnSensingComponent.h |
|
|
virtual FVector GetSensorLocation () |
Get position where hearing/seeing occurs (i.e. ear/eye position). | Perception/PawnSensingComponent.h | |
virtual FRotator GetSensorRotation() |
Get the rotation of this sensor. We need this for the sight component | Perception/PawnSensingComponent.h | |
virtual bool HasLineOfSightTo
(
const AActor* Other |
Check line to other actor. | Perception/PawnSensingComponent.h | |
bool IsNoiseRelevant
(
const APawn& Pawn, |
Test whether the noise is loud enough and recent enough to care about. | Perception/PawnSensingComponent.h | |
virtual 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. | Perception/PawnSensingComponent.h | |
virtual void SetPeripheralVisionAngle
(
const float NewPeripheralVisionAngle |
Sets PeripheralVisionAngle. Calculates PeripheralVisionCosine from PeripheralVisionAngle | Perception/PawnSensingComponent.h |
|
virtual void SetSensingInterval
(
const float NewSensingInterval |
Changes the SensingInterval. | Perception/PawnSensingComponent.h |
|
virtual void SetSensingUpdatesEnabled
(
const bool bEnabled |
Enables or disables sensing updates. The timer is reset in either case. | Perception/PawnSensingComponent.h |
|
virtual 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) | Perception/PawnSensingComponent.h | |
virtual 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) | Perception/PawnSensingComponent.h |
Overridden from UActorComponent
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void InitializeComponent() |
Perception/PawnSensingComponent.h |
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void BroadcastOnHearLocalNoise
(
APawn& Instigator, |
Broadcasts notification that our sensor hears a noise made local to a Pawn's position, using the OnHearNoise delegates. | Perception/PawnSensingComponent.h | |
virtual void BroadcastOnHearRemoteNoise
(
APawn& Instigator, |
Broadcasts notification that our sensor hears a noise made remotely from a Pawn's position, using the OnHearNoise delegates. | Perception/PawnSensingComponent.h | |
virtual void BroadcastOnSeePawn
(
APawn& Pawn |
Broadcasts notification that our sensor sees a Pawn, using the OnSeePawn delegates. | Perception/PawnSensingComponent.h | |
AActor * GetSensorActor() |
Perception/PawnSensingComponent.h | ||
AController * GetSensorController() |
Perception/PawnSensingComponent.h | ||
virtual void OnTimer() |
Update function called on timer intervals. | Perception/PawnSensingComponent.h | |
virtual void SensePawn
(
APawn& Pawn |
See if there are interesting sounds and sights that we want to detect, and respond to them if so. | Perception/PawnSensingComponent.h | |
virtual void SetTimer
(
const float TimeDelay |
Modify the timer to fire in TimeDelay seconds. A value <= 0 disables the timer. | Perception/PawnSensingComponent.h | |
virtual void UpdateAISensing() |
Calls SensePawn on any Pawns that we are allowed to sense. | Perception/PawnSensingComponent.h |