Navigation
API > API/Runtime > API/Runtime/AIModule
AIPerceptionComponent is used to register as stimuli listener in AIPerceptionSystem and gathers registered stimuli. UpdatePerception is called when component gets new stimuli (batched)
| Name | UAIPerceptionComponent |
| Type | class |
| Header File | /Engine/Source/Runtime/AIModule/Classes/Perception/AIPerceptionComponent.h |
| Include Path | #include "Perception/AIPerceptionComponent.h" |
Syntax
UCLASS (ClassGroup=AI, HideCategories=(Activation, Collision), Meta=(BlueprintSpawnableComponent),
Config=Game, MinimalAPI)
class UAIPerceptionComponent : public UActorComponent
Inheritance Hierarchy
- UObjectBase → UObjectBaseUtility → UObject → UActorComponent → UAIPerceptionComponent
Implements Interfaces
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
UAIPerceptionComponent
(
const FObjectInitializer& ObjectInitializer |
Perception/AIPerceptionComponent.h |
Structs
| Name | Remarks |
|---|---|
| FStimulusToProcess |
Typedefs
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| FActorPerceptionContainer | TActorPerceptionContainer | Perception/AIPerceptionComponent.h | |
| TActorPerceptionContainer | TMap< TObjectKey< AActor >, FActorPerceptionInfo > | Perception/AIPerceptionComponent.h | |
| TAISenseConfigConstIterator | TArray< UAISenseConfig * >::TConstIterator | Perception/AIPerceptionComponent.h |
Constants
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| InitialStimuliToProcessArraySize | const int32 | Perception/AIPerceptionComponent.h |
Variables
Public
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| OnPerceptionUpdated | FPerceptionUpdatedDelegate | Might want to move these to special "BP_AIPerceptionComponent". | Perception/AIPerceptionComponent.h |
|
| OnTargetPerceptionForgotten | FActorPerceptionForgetUpdatedDelegate | Notifies all bound delegates that the perception info has been forgotten for a given target. | Perception/AIPerceptionComponent.h |
|
| OnTargetPerceptionInfoUpdated | FActorPerceptionInfoUpdatedDelegate | Notifies all bound objects that perception info has been updated for a given target. | Perception/AIPerceptionComponent.h |
|
| OnTargetPerceptionUpdated | FActorPerceptionUpdatedDelegate | Notifies all bound objects that perception info has been updated for a given target. | Perception/AIPerceptionComponent.h |
|
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| bCleanedUp | uint32 | Perception/AIPerceptionComponent.h | ||
| bForgetStaleActors | uint32 | Determines whether all knowledge of previously sensed actors will be removed or not when they become stale. | Perception/AIPerceptionComponent.h | |
| PerceptionListenerId | FPerceptionListenerID | Perception/AIPerceptionComponent.h | ||
| PerceptualData | FActorPerceptionContainer | Perception/AIPerceptionComponent.h | ||
| UAIPerceptionSystem | friend | Perception/AIPerceptionComponent.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
bool AgeStimuli
(
const float ConstPerceptionAgingRate |
Returns true if, as result of stimuli aging, this listener needs an update (like if some stimuli expired) | Perception/AIPerceptionComponent.h | |
void ConfigureSense
(
UAISenseConfig& SenseConfig |
Perception/AIPerceptionComponent.h | ||
virtual void DescribeSelfToVisLog
(
FVisualLogEntry* Snapshot |
Perception/AIPerceptionComponent.h | ||
void ForgetActor
(
AActor* ActorToForget |
Perception/AIPerceptionComponent.h | ||
void ForgetAll() |
Basically cleans up PerceptualData, resulting in loss of all previous perception | Perception/AIPerceptionComponent.h |
|
const FActorPerceptionInfo * GetActorInfo
(
const AActor& Actor |
Perception/AIPerceptionComponent.h | ||
FVector GetActorLocation
(
const AActor& Actor |
Perception/AIPerceptionComponent.h | ||
bool GetActorsPerception
(
AActor* Actor, |
Retrieves whatever has been sensed about given actor | Perception/AIPerceptionComponent.h |
|
const AActor * GetBodyActor() |
Perception/AIPerceptionComponent.h | ||
void GetCurrentlyPerceivedActors
(
TSubclassOf< UAISense > SenseToUse, |
If SenseToUse is none all actors currently perceived in any way will get fetched | Perception/AIPerceptionComponent.h |
|
TSubclassOf< UAISense > GetDominantSense() |
Perception/AIPerceptionComponent.h | ||
FAISenseID GetDominantSenseID() |
Perception/AIPerceptionComponent.h | ||
bool GetFilteredActors
(
const TFunctionRef< bool(const FActorPerceptionInfo&)>& Predicate, |
Retrieves all actors in PerceptualData matching the predicate. | Perception/AIPerceptionComponent.h | |
const FActorPerceptionInfo * GetFreshestTrace
(
const FAISenseID Sense |
Will stop on first age 0 stimulus | Perception/AIPerceptionComponent.h | |
| Perception/AIPerceptionComponent.h | |||
void GetHostileActorsBySense
(
TSubclassOf< UAISense > SenseToFilterBy, |
Perception/AIPerceptionComponent.h | ||
void GetKnownPerceivedActors
(
TSubclassOf< UAISense > SenseToUse, |
If SenseToUse is none all actors ever perceived in any way (and not forgotten yet) will get fetched | Perception/AIPerceptionComponent.h |
|
FPerceptionListenerID GetListenerId() |
Perception/AIPerceptionComponent.h | ||
void GetLocationAndDirection
(
FVector& Location, |
Perception/AIPerceptionComponent.h | ||
AActor * GetMutableBodyActor() |
Perception/AIPerceptionComponent.h | ||
| Perception/AIPerceptionComponent.h |
|
||
void GetPerceivedHostileActorsBySense
(
const TSubclassOf< UAISense > SenseToUse, |
Perception/AIPerceptionComponent.h |
|
|
FPerceptionChannelAllowList GetPerceptionFilter() |
Perception/AIPerceptionComponent.h | ||
FActorPerceptionContainer::TConstIterator GetPerceptualDataConstIterator() |
Perception/AIPerceptionComponent.h | ||
FActorPerceptionContainer::TIterator GetPerceptualDataIterator() |
Perception/AIPerceptionComponent.h | ||
T * GetSenseConfig () |
Perception/AIPerceptionComponent.h | ||
const UAISenseConfig * GetSenseConfig
(
const FAISenseID& SenseID |
Perception/AIPerceptionComponent.h | ||
UAISenseConfig * GetSenseConfig
(
const FAISenseID& SenseID |
Perception/AIPerceptionComponent.h | ||
TAISenseConfigConstIterator GetSensesConfigIterator() |
Perception/AIPerceptionComponent.h | ||
FGenericTeamId GetTeamIdentifier() |
Perception/AIPerceptionComponent.h | ||
float GetYoungestStimulusAge
(
const AActor& Source |
Perception/AIPerceptionComponent.h | ||
bool HasActiveStimulus
(
const AActor& Source, |
Perception/AIPerceptionComponent.h | ||
bool HasAnyActiveStimulus
(
const AActor& Source |
Perception/AIPerceptionComponent.h | ||
bool HasAnyCurrentStimulus
(
const AActor& Source |
Perception/AIPerceptionComponent.h | ||
bool IsSenseEnabled
(
TSubclassOf< UAISense > SenseClass |
Returns if a sense is active. | Perception/AIPerceptionComponent.h |
|
void OnOwnerEndPlay
(
AActor* Actor, |
Perception/AIPerceptionComponent.h | ||
void ProcessStimuli() |
Perception/AIPerceptionComponent.h | ||
void RegisterStimulus
(
AActor* Source, |
Perception/AIPerceptionComponent.h | ||
void RequestStimuliListenerUpdate() |
Notifies AIPerceptionSystem to update properties for this "stimuli listener" | Perception/AIPerceptionComponent.h |
|
void SetDominantSense
(
TSubclassOf< UAISense > InDominantSense |
Perception/AIPerceptionComponent.h | ||
void SetSenseEnabled
(
TSubclassOf< UAISense > SenseClass, |
Note that this works only if given sense has been already configured for this component instance | Perception/AIPerceptionComponent.h |
|
void UpdatePerceptionAllowList
(
const FAISenseID Channel, |
Allows toggling senses on and off | Perception/AIPerceptionComponent.h | |
void UpdatePerceptionWhitelist
(
const FAISenseID Channel, |
Perception/AIPerceptionComponent.h |
Overridden from UActorComponent
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void OnRegister() |
Perception/AIPerceptionComponent.h | ||
virtual void OnUnregister() |
Perception/AIPerceptionComponent.h |
Overridden from UObject
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void BeginDestroy() |
Perception/AIPerceptionComponent.h | ||
virtual void PostInitProperties() |
Perception/AIPerceptionComponent.h |
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void CleanUp() |
Called to clean up on owner's end play or destruction | Perception/AIPerceptionComponent.h | |
virtual bool ConditionallyStoreSuccessfulStimulus
(
FAIStimulus& StimulusStore, |
Updates the stimulus entry in StimulusStore, if NewStimulus is more recent or stronger | Perception/AIPerceptionComponent.h | |
const FActorPerceptionContainer & GetPerceptualData () |
Perception/AIPerceptionComponent.h | ||
FActorPerceptionContainer & GetPerceptualData () |
Perception/AIPerceptionComponent.h | ||
virtual void HandleExpiredStimulus
(
FAIStimulus& StimulusStore |
No need to call super implementation, it's there just for some validity checking | Perception/AIPerceptionComponent.h | |
virtual void RefreshStimulus
(
FAIStimulus& StimulusStore, |
Updates the stimulus entry in StimulusStore, if NewStimulus is more recent or stronger | Perception/AIPerceptionComponent.h | |
void RemoveDeadData() |
Perception/AIPerceptionComponent.h |