Navigation
API > API/Runtime > API/Runtime/AIModule > API/Runtime/AIModule/Perception
Inheritance Hierarchy
- UObjectBase
- UObjectBaseUtility
- UObject
- UActorComponent
- UAIPerceptionComponent
References
| Module | AIModule |
| Header | /Engine/Source/Runtime/AIModule/Classes/Perception/AIPerceptionComponent.h |
| Include | #include "Perception/AIPerceptionComponent.h" |
Syntax
class UAIPerceptionComponent : public UActorComponent
Remarks
AIPerceptionComponent is used to register as stimuli listener in AIPerceptionSystem and gathers registered stimuli. UpdatePerception is called when component gets new stimuli (batched)
Variables
| Type | Name | Description | |
|---|---|---|---|
| TObjectPtr< AAIController > | AIOwner | ||
| TSubclassOf< UAISense > | DominantSense | Indicated sense that takes precedence over other senses when determining sensed actor's location. | |
| FAISenseID | DominantSenseID | ||
| TArray< float > | MaxActiveAge | Max age of stimulus to consider it "active" (e.g. target is visible) | |
| FPerceptionUpdatedDelegate | OnPerceptionUpdated | Might want to move these to special "BP_AIPerceptionComponent". | |
| FActorPerceptionForgetUpdatedDelegate | OnTargetPerceptionForgotten | Notifies all bound delegates that the perception info has been forgotten for a given target. | |
| FActorPerceptionInfoUpdatedDelegate | OnTargetPerceptionInfoUpdated | Notifies all bound objects that perception info has been updated for a given target. | |
| FActorPerceptionUpdatedDelegate | OnTargetPerceptionUpdated | Notifies all bound objects that perception info has been updated for a given target. | |
| FPerceptionChannelAllowList | PerceptionFilter | ||
| TArray< TObjectPtr< UAISenseConfig > > | SensesConfig | ||
| TArray< FStimulusToProcess > | StimuliToProcess |
Constructors
| Type | Name | Description | |
|---|---|---|---|
UAIPerceptionComponent
(
const FObjectInitializer& ObjectInitializer |
Functions
| Type | Name | Description | |
|---|---|---|---|
| bool | AgeStimuli
(
const float ConstPerceptionAgingRate |
Returns true if, as result of stimuli aging, this listener needs an update (like if some stimuli expired) | |
| void | CleanUp () |
Called to clean up on owner's end play or destruction | |
| void | ConfigureSense
(
UAISenseConfig& SenseConfig |
||
| void | DescribeSelfToVisLog
(
FVisualLogEntry* Snapshot |
||
| void | ForgetActor
(
AActor* ActorToForget |
||
| void | ForgetAll () |
Basically cleans up PerceptualData, resulting in loss of all previous perception | |
| const FActorPerceptionInfo * | GetActorInfo
(
const AActor& Actor |
||
| FVector | GetActorLocation
(
const AActor& Actor |
||
| bool | GetActorsPerception
(
AActor* Actor, |
Retrieves whatever has been sensed about given actor | |
| const AActor * | GetBodyActor () |
||
| void | GetCurrentlyPerceivedActors
(
TSubclassOf< UAISense > SenseToUse, |
If SenseToUse is none all actors currently perceived in any way will get fetched | |
| TSubclassOf< UAISense > | |||
| FAISenseID | |||
| bool | GetFilteredActors
(
TFunctionRef< bool(const FActorPerceptionInfo&)> Predicate, |
Retrieves all actors in PerceptualData matching the predicate. | |
| const FActorPerceptionInfo * | GetFreshestTrace
(
const FAISenseID Sense |
Will stop on first age 0 stimulus | |
| void | GetHostileActors
(
TArray< AActor* >& OutActors |
||
| void | GetHostileActorsBySense
(
TSubclassOf< UAISense > SenseToFilterBy, |
||
| void | GetKnownPerceivedActors
(
TSubclassOf< UAISense > SenseToUse, |
If SenseToUse is none all actors ever perceived in any way (and not forgotten yet) will get fetched | |
| FPerceptionListenerID | |||
| void | GetLocationAndDirection
(
FVector& Location, |
||
| AActor * | |||
| void | GetPerceivedHostileActors
(
TArray< AActor* >& OutActors |
||
| void | GetPerceivedHostileActorsBySense
(
const TSubclassOf< UAISense > SenseToUse, |
||
| const FPerceptionChannelAllowList | |||
| const FActorPerceptionContainer & | |||
| FActorPerceptionContainer & | |||
| FActorPerceptionContainer::TConstIterator | |||
| FActorPerceptionContainer::TIterator | |||
| const UAISenseConfig * | GetSenseConfig
(
const FAISenseID& SenseID |
||
| UAISenseConfig * | GetSenseConfig
(
const FAISenseID& SenseID |
||
| TAISenseConfigConstIterator | |||
| FGenericTeamId | |||
| float | GetYoungestStimulusAge
(
const AActor& Source |
||
| void | HandleExpiredStimulus
(
FAIStimulus& StimulusStore |
No need to call super implementation, it's there just for some validity checking | |
| bool | HasActiveStimulus
(
const AActor& Source, |
||
| bool | HasAnyActiveStimulus
(
const AActor& Source |
||
| bool | HasAnyCurrentStimulus
(
const AActor& Source |
||
| void | OnOwnerEndPlay
(
AActor* Actor, |
||
| void | |||
| void | RefreshStimulus
(
FAIStimulus& StimulusStore, |
Updates the stimulus entry in StimulusStore, if NewStimulus is more recent or stronger | |
| void | RegisterStimulus
(
AActor* Source, |
||
| void | |||
| void | Notifies AIPerceptionSystem to update properties for this "stimuli listener" | ||
| void | SetDominantSense
(
TSubclassOf< UAISense > InDominantSense |
||
| void | SetSenseEnabled
(
TSubclassOf< UAISense > SenseClass, |
Note that this works only if given sense has been already configured for this component instance | |
| void | UpdatePerceptionAllowList
(
const FAISenseID Channel, |
Allows toggling senses on and off |
Overridden from UActorComponent
| Type | Name | Description | |
|---|---|---|---|
| void | OnRegister () |
Called when a component is registered, after Scene is set, but before CreateRenderState_Concurrent or OnCreatePhysicsState are called. | |
| void | OnUnregister () |
Called when a component is unregistered. |
Overridden from UObject
| Type | Name | Description | |
|---|---|---|---|
| void | BeginDestroy () |
Called before destroying the object. | |
| void | Called after the C++ constructor and after the properties have been initialized, including those loaded from config. |
Classes
| Type | Name | Description | |
|---|---|---|---|
| FStimulusToProcess |
Typedefs
Constants
| Name | Description |
|---|---|
| InitialStimuliToProcessArraySize |
Deprecated Functions
| Type | Name | Description | |
|---|---|---|---|
| void | UpdatePerceptionWhitelist
(
const FAISenseID Channel, |
Use UpdatePerceptionAllowList instead |