UAIPerceptionComponent

AIPerceptionComponent is used to register as stimuli listener in AIPerceptionSystem and gathers registered stimuli.

Windows
MacOS
Linux

Inheritance Hierarchy

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

Name Description

Protected variable

AAIController &...

 

AIOwner

Protected variable

TSubclassOf< UA...

 

DominantSense

Indicated sense that takes precedence over other senses when determining sensed actor's location.

Protected variable

FAISenseID

 

DominantSenseID

Protected variable

TArray< float >

 

MaxActiveAge

Max age of stimulus to consider it "active" (e.g. target is visible)

Public variable

FPerceptionUpda...

 

OnPerceptionUpdated

Might want to move these to special "BP_AIPerceptionComponent".

Public variable

FActorPerceptio...

 

OnTargetPerceptionInfoUpdated

Notifies all bound objects that perception info has been updated for a given target.

Public variable

FActorPerceptio...

 

OnTargetPerceptionUpdated

Notifies all bound objects that perception info has been updated for a given target.

Protected variable

FPerceptionChan...

 

PerceptionFilter

Protected variable

TArray< UAISens...

 

SensesConfig

Protected variable

TArray< FStimul...

 

StimuliToProcess

Constructors

Name Description

Public function

UAIPerceptionComponent

(
    const FObjectInitializer& ObjectIn...
)

Functions

Name Description

Public function

bool

 

AgeStimuli

(
    const float ConstPerceptionAgingRat...
)

Returns true if, as result of stimuli aging, this listener needs an update (like if some stimuli expired)

Protected function Virtual

void

 

CleanUp()

Called to clean up on owner's end play or destruction

Public function

void

 

ConfigureSense

(
    UAISenseConfig& SenseConfig
)

Public function Virtual Const

void

 

DescribeSelfToVisLog

(
    FVisualLogEntry* Snapshot
)

Public function

void

 

ForgetActor

(
    AActor* ActorToForget
)

Public function

void

 

ForgetAll()

Basically cleans up PerceptualData, resulting in loss of all previous perception

Public function Const

const FActor...

 

GetActorInfo

(
    const AActor& Actor
)

Public function Const

FVector

 

GetActorLocation

(
    const AActor& Actor
)

Public function

bool

 

GetActorsPerception

(
    AActor* Actor,
    FActorPerceptionBlueprintInfo& Inf...
)

Retrieves whatever has been sensed about given actor

Public function Const

const AActor...

 

GetBodyActor()

Public function Const

void

 

GetCurrentlyPerceivedActors

(
    TSubclassOf< UAISense > SenseToUse,
    TArray< AActor* >& OutActors
)

If SenseToUse is none all actors currently perceived in any way will get fetched

Public function Const

TSubclassOf<...

 

GetDominantSense()

Public function Const

FAISenseID

 

GetDominantSenseID()

Public function Const

bool

 

GetFilteredActors

(
    TFunctionRef< bool...,
    TArray< AActor* >& OutActors
)

Retrieves all actors in PerceptualData matching the predicate.

Public function Const

const FActor...

 

GetFreshestTrace

(
    const FAISenseID Sense
)

@note Will stop on first age 0 stimulus

Public function Virtual Const

void

 

GetHostileActors

(
    TArray< AActor* >& OutActors
)

Public function Const

void

 

GetHostileActorsBySense

(
    TSubclassOf< UAISense > SenseToFilt...,
    TArray< AActor* >& OutActors
)

Public function Const

void

 

GetKnownPerceivedActors

(
    TSubclassOf< UAISense > SenseToUse,
    TArray< AActor* >& OutActors
)

If SenseToUse is none all actors ever perceived in any way (and not forgotten yet) will get fetched

Public function Const

FPerceptionL...

 

GetListenerId()

Public function Const

void

 

GetLocationAndDirection

(
    FVector& Location,
    FVector& Direction
)

Public function

AActor *

 

GetMutableBodyActor()

Public function Const

void

 

GetPerceivedHostileActors

(
    TArray< AActor* >& OutActors
)

Public function Const

void

 

GetPerceivedHostileActorsBySense

(
    const TSubclassOf< UAISense > Sense...,
    TArray< AActor* >& OutActors
)

Public function Const

const FPerce...

 

GetPerceptionFilter()

Protected function Const

const FActor...

 

GetPerceptualData()

Protected function

FActorPercep...

 

GetPerceptualData()

Public function Const

FActorPercep...

 

GetPerceptualDataConstIterator()

Public function

FActorPercep...

 

GetPerceptualDataIterator()

Public function Const

const UAISen...

 

GetSenseConfig

(
    const FAISenseID& SenseID
)

Public function

UAISenseConf...

 

GetSenseConfig

(
    const FAISenseID& SenseID
)

Public function Const

TAISenseConf...

 

GetSensesConfigIterator()

Public function Const

FGenericTeam...

 

GetTeamIdentifier()

Public function Const

float

 

GetYoungestStimulusAge

(
    const AActor& Source
)

Protected function Virtual

void

 

HandleExpiredStimulus

(
    FAIStimulus& StimulusStore
)

@note no need to call super implementation, it's there just for some validity checking

Public function Const

bool

 

HasActiveStimulus

(
    const AActor& Source,
    FAISenseID Sense
)

Public function Const

bool

 

HasAnyActiveStimulus

(
    const AActor& Source
)

Public function Const

bool

 

HasAnyCurrentStimulus

(
    const AActor& Source
)

Public function

void

 

OnOwnerEndPlay

(
    AActor* Actor,
    EEndPlayReason::Type EndPlayReason
)

Public function

void

 

ProcessStimuli()

Protected function Virtual

void

 

RefreshStimulus

(
    FAIStimulus& StimulusStore,
    const FAIStimulus& NewStimulus
)

Updates the stimulus entry in StimulusStore, if NewStimulus is more recent or stronger

Public function

void

 

RegisterStimulus

(
    AActor* Source,
    const FAIStimulus& Stimulus
)

Protected function

void

 

RemoveDeadData()

Public function

void

 

RequestStimuliListenerUpdate()

Notifies AIPerceptionSystem to update properties for this "stimuli listener"

Public function

void

 

SetDominantSense

(
    TSubclassOf< UAISense > InDominantS...
)

Public function

void

 

SetSenseEnabled

(
    TSubclassOf< UAISense > SenseClass,
    const bool bEnable
)

That this works only if given sense has been already configured for this component instance

Public function

void

 

UpdatePerceptionWhitelist

(
    const FAISenseID Channel,
    const bool bNewValue
)

Allows toggling senses on and off

Overridden from UActorComponent

Name Description

Public function Virtual

void

 

OnRegister()

Called when a component is registered, after Scene is set, but before CreateRenderState_Concurrent or OnCreatePhysicsState are called.

Public function Virtual

void

 

OnUnregister()

Called when a component is unregistered.

Overridden from UObject

Name Description

Public function Virtual

void

 

BeginDestroy()

Called before destroying the object.

Public function Virtual

void

 

PostInitProperties()

Called after the C++ constructor and after the properties have been initialized, including those loaded from config.

Classes

Name

Description

Protected struct

FStimulusToProcess

Typedefs

Constants

Deprecated Functions

Name Description

Public function Const

void

 

GetPerceivedActors

(
    TSubclassOf< UAISense > SenseToUse,
    TArray< AActor* >& OutActors
)

GetPerceivedActors is deprecated. Use GetCurrentlyPerceivedActors or GetKnownPerceivedActors

Protected function

void

 

UpdatePerceptionFilter

(
    FAISenseID Channel,
    bool bNewValue
)

Function has been renamed and made public. Please use UpdatePerceptionWhitelist instead

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss