4#include "EngineDefines.h"
5#include "EngineGlobals.h"
6#include "CollisionQueryParams.h"
7#include "Engine/Engine.h"
8#include "AIModule/Classes/AISystem.h"
9#include "AIModule/Classes/Perception/AIPerceptionComponent.h"
10#include "VisualLogger/VisualLogger.h"
11#include "AIModule/Classes/Perception/AISightTargetInterface.h"
12#include "AIModule/Classes/Perception/AISenseConfig_Sight.h"
13#include "AIModule/Classes/Perception/AIPerceptionSystem.h"
15#if WITH_GAMEPLAY_DEBUGGER
16#include "GameplayDebugger/Public/GameplayDebuggerTypes.h"
17#include "GameplayDebugger/Public/GameplayDebuggerCategory.h"
21#define DO_SIGHT_VLOGGINGVR (0 && ENABLE_VISUAL_LOG)
23#if DO_SIGHT_VLOGGINGVR
24#define SIGHT_LOG_SEGMENTVR UE_VLOG_SEGMENT
25#define SIGHT_LOG_LOCATIONVR UE_VLOG_LOCATION
27#define SIGHT_LOG_SEGMENTVR(...)
28#define SIGHT_LOG_LOCATIONVR(...)
32DECLARE_CYCLE_STAT(TEXT(
"Perception Sense: Sight, Update Sort"), STAT_AI_Sense_Sight_UpdateSort, STATGROUP_AI);
33DECLARE_CYCLE_STAT(TEXT(
"Perception Sense: Sight, Listener Update"), STAT_AI_Sense_Sight_ListenerUpdate, STATGROUP_AI);
34DECLARE_CYCLE_STAT(TEXT(
"Perception Sense: Sight, Register Target"), STAT_AI_Sense_Sight_RegisterTarget, STATGROUP_AI);
35DECLARE_CYCLE_STAT(TEXT(
"Perception Sense: Sight, Remove By Listener"), STAT_AI_Sense_Sight_RemoveByListener, STATGROUP_AI);
36DECLARE_CYCLE_STAT(TEXT(
"Perception Sense: Sight, Remove To Target"), STAT_AI_Sense_Sight_RemoveToTarget, STATGROUP_AI);
48template <
typename T,
class PREDICATE_CLASS>
51 for (
typename T::ElementType& Element :
Array)
67template <
typename T,
class PREDICATE_CLASS>
71 for (int32 Index =
Array.Num() - 1; Index >= 0; --Index)
86 if (FVector::DistSquared(Listener.CachedLocation, TargetLocation) <= SightRadiusSq)
88 const FVector DirectionToTarget = (TargetLocation - Listener.CachedLocation).GetUnsafeNormal();
101 : Target(InTarget), SightTargetInterface(NULL), TeamId(InTeamId)
127 : PeripheralVisionAngleCos(0.f), SightRadiusSq(-1.f), AutoSuccessRangeSqFromLastSeenLocation(FAISystem::InvalidRange), LoseSightRadiusSq(-1.f), AffiliationFlags(-1)
133UAISense_Sight_VR::UAISense_Sight_VR(
const FObjectInitializer& ObjectInitializer)
134 : Super(ObjectInitializer)
142 if (HasAnyFlags(RF_ClassDefaultObject) ==
false)
145 SightConfigCDO->
Implementation = UAISense_Sight_VR::StaticClass();
152 NotifyType = EAISenseNotifyType::OnPerceptionChange;
154 bAutoRegisterAllPawnsAsSources =
true;
155 bNeedsForgettingNotification =
true;
162 const float DistanceSq = FVector::DistSquared(Listener.CachedLocation, TargetLocation);
169 Super::PostInitProperties();
174void UAISenseConfig_Sight_VR::PostEditChangeChainProperty(FPropertyChangedChainEvent& PropertyChangedEvent)
176 static const FName NAME_AutoSuccessRangeFromLastSeenLocation = GET_MEMBER_NAME_CHECKED(
UAISenseConfig_Sight_VR, AutoSuccessRangeFromLastSeenLocation);
178 Super::PostEditChangeProperty(PropertyChangedEvent);
180 if (PropertyChangedEvent.Property)
182 const FName PropName = PropertyChangedEvent.Property->GetFName();
183 if (PropName == NAME_AutoSuccessRangeFromLastSeenLocation)
185 if (AutoSuccessRangeFromLastSeenLocation < 0)
187 AutoSuccessRangeFromLastSeenLocation = FAISystem::InvalidRange;
196 OutStimulusStrength = 1.0f;
201 const AVRBaseCharacter * VRChar = Cast<const AVRBaseCharacter>(TargetActor);
202 const float DistanceToLastSeenLocationSq = FVector::DistSquared(VRChar !=
nullptr ? VRChar->
GetVRLocation_Inline() : TargetActor->GetActorLocation(), SightQuery->
LastSeenLocation);
211 SCOPE_CYCLE_COUNTER(STAT_AI_Sense_Sight);
213 const UWorld* World = GEngine->GetWorldFromContextObject(GetPerceptionSystem()->GetOuter(), EGetWorldErrorMode::LogAndReturnNull);
217 return SuspendNextUpdate;
224 SightQuery.RecalcScore();
228 SCOPE_CYCLE_COUNTER(STAT_AI_Sense_Sight_UpdateSort);
243 int32 TracesCount = 0;
244 int32 NumQueriesProcessed = 0;
246 bool bHitTimeSliceLimit =
false;
248#ifdef AISENSE_SIGHT_TIMESLICING_DEBUG
249 double TimeSpent = 0.0;
250 double LastTime = FPlatformTime::Seconds();
252 static const int32 InitialInvalidItemsSize = 16;
253 enum class EOperationType : uint8
258 struct FQueryOperation
260 FQueryOperation(
bool bInInRange, EOperationType InOpType, int32 InIndex) : bInRange(bInInRange), OpType(InOpType), Index(InIndex) {}
262 EOperationType OpType;
265 TArray<FQueryOperation> QueryOperations;
266 TArray<FAISightTargetVR::FTargetId> InvalidTargets;
267 QueryOperations.Reserve(InitialInvalidItemsSize);
268 InvalidTargets.Reserve(InitialInvalidItemsSize);
270 AIPerception::FListenerMap& ListenersMap = *GetListeners();
272 int32 InRangeItr = 0;
273 int32 OutOfRangeItr = 0;
277 int32 InRangeIndex =
SightQueriesInRange.IsValidIndex(InRangeItr) ? InRangeItr : INDEX_NONE;
289 const bool bIsInRangeQuery = (InRangeQuery && OutOfRangeQuery) ?
FAISightQueryVR::FSortPredicate()(*InRangeQuery, *OutOfRangeQuery) : !OutOfRangeQuery;
290 FAISightQueryVR* SightQuery = bIsInRangeQuery ? InRangeQuery : OutOfRangeQuery;
293 NumQueriesProcessed++;
294#ifdef AISENSE_SIGHT_TIMESLICING_DEBUG
295 TimeSpent += (FPlatformTime::Seconds() - LastTime);
296 LastTime = FPlatformTime::Seconds();
298 if (bHitTimeSliceLimit ==
false && (NumQueriesProcessed %
MinQueriesPerTimeSliceCheck) == 0 && FPlatformTime::Seconds() > TimeSliceEnd)
300 bHitTimeSliceLimit =
true;
306 bIsInRangeQuery ? ++InRangeItr : ++OutOfRangeItr;
308 FPerceptionListener& Listener = ListenersMap[SightQuery->
ObserverId];
312 UAIPerceptionComponent* ListenerPtr = Listener.Listener.Get();
316 if (TargetActor && ListenerPtr)
320 const AVRBaseCharacter * VRChar = Cast<const AVRBaseCharacter>(TargetActor);
321 const FVector TargetLocation = VRChar !=
nullptr ? VRChar->
GetVRLocation_Inline() : TargetActor->GetActorLocation();
326 float StimulusStrength = 1.f;
330 if (bShouldAutomatically)
333 Listener.RegisterStimulus(TargetActor, FAIStimulus(*
this, StimulusStrength, SightQuery->
LastSeenLocation, Listener.CachedLocation));
338 SIGHT_LOG_SEGMENTVR(ListenerPtr->GetOwner(), Listener.CachedLocation, TargetLocation, FColor::Green, TEXT(
"%s"), *(Target.
TargetId.ToString()));
340 FVector OutSeenLocation(0.f);
344 int32 NumberOfLoSChecksPerformed = 0;
347 if (Target.
SightTargetInterface->CanBeSeenFrom(Listener.CachedLocation, OutSeenLocation, NumberOfLoSChecksPerformed, StimulusStrength, ListenerPtr->GetBodyActor(), &bWasVisible, &SightQuery->
UserData) ==
true)
349 Listener.RegisterStimulus(TargetActor, FAIStimulus(*
this, StimulusStrength, OutSeenLocation, Listener.CachedLocation));
356 Listener.RegisterStimulus(TargetActor, FAIStimulus(*
this, 0.f, TargetLocation, Listener.CachedLocation, FAIStimulus::SensingFailed));
366 TracesCount += NumberOfLoSChecksPerformed;
371 FHitResult HitResult;
372 const bool bHit = World->LineTraceSingleByChannel(HitResult, Listener.CachedLocation, TargetLocation
374 , FCollisionQueryParams(SCENE_QUERY_STAT(AILineOfSight),
true, ListenerPtr->GetBodyActor()));
378 auto HitResultActorIsOwnedByTargetActor = [&HitResult, TargetActor]()
380 AActor* HitResultActor = HitResult.Actor.Get();
381 return (HitResultActor ? HitResultActor->IsOwnedBy(TargetActor) :
false);
384 if (bHit ==
false || HitResultActorIsOwnedByTargetActor())
386 Listener.RegisterStimulus(TargetActor, FAIStimulus(*
this, 1.f, TargetLocation, Listener.CachedLocation));
393 Listener.RegisterStimulus(TargetActor, FAIStimulus(*
this, 0.f, TargetLocation, Listener.CachedLocation, FAIStimulus::SensingFailed));
407 SIGHT_LOG_SEGMENTVR(ListenerPtr->GetOwner(), Listener.CachedLocation, TargetLocation, FColor::Red, TEXT(
"%s"), *(Target.
TargetId.ToString()));
408 Listener.RegisterStimulus(TargetActor, FAIStimulus(*
this, 0.f, TargetLocation, Listener.CachedLocation, FAIStimulus::SensingFailed));
413 const bool bShouldBeInRange = SightQuery->
Importance > 0.0f;
414 if (bIsInRangeQuery != bShouldBeInRange)
416 QueryOperations.Add(FQueryOperation(bIsInRangeQuery, EOperationType::SwapList, bIsInRangeQuery ? InRangeIndex : OutOfRangeIndex));
425 QueryOperations.Add(FQueryOperation(bIsInRangeQuery, EOperationType::Remove, bIsInRangeQuery ? InRangeIndex : OutOfRangeIndex));
426 if (TargetActor ==
nullptr)
428 InvalidTargets.AddUnique(SightQuery->
TargetId);
440#ifdef AISENSE_SIGHT_TIMESLICING_DEBUG
441 UE_LOG(LogAIPerceptionVR, VeryVerbose, TEXT(
"UAISense_Sight_VR::Update processed %d sources in %f seconds [time slice limited? %d]"), NumQueriesProcessed, TimeSpent, bHitTimeSliceLimit ? 1 : 0);
443 UE_LOG(LogAIPerceptionVR, VeryVerbose, TEXT(
"UAISense_Sight_VR::Update processed %d sources [time slice limited? %d]"), NumQueriesProcessed, bHitTimeSliceLimit ? 1 : 0);
446 if (QueryOperations.Num() > 0)
449 QueryOperations.Sort([](
const FQueryOperation& LHS,
const FQueryOperation& RHS)->bool
451 if (LHS.bInRange != RHS.bInRange)
453 return LHS.Index > RHS.Index;
456 TArray<FAISightQueryVR> SightQueriesOutOfRangeToInsert;
457 for (FQueryOperation& Operation : QueryOperations)
459 if (Operation.OpType == EOperationType::SwapList)
461 if (Operation.bInRange)
471 if (Operation.bInRange)
487 if (SightQueriesOutOfRangeToInsert.Num() > 0)
493 if (InvalidTargets.Num() > 0)
496 UE_VLOG(GetPerceptionSystem(), LogAIPerceptionVR,
Error, TEXT(
"Invalid sight targets found during UAISense_Sight_VR::Update call"));
498 for (
const auto& TargetId : InvalidTargets)
539 AIPerception::FListenerMap& ListenersMap = *GetListeners();
540 auto RemoveQuery = [
this, &ListenersMap, &AsTargetId, &TargetActor](TArray<FAISightQueryVR>& SightQueries,
const int32 QueryIndex)->
EReverseForEachResult
543 if (SightQuery->
TargetId == AsTargetId)
547 FPerceptionListener& Listener = ListenersMap[SightQuery->
ObserverId];
548 ensure(Listener.Listener.IsValid());
550 Listener.RegisterStimulus(TargetActor, FAIStimulus(*
this, 0.f, SightQuery->
LastSeenLocation, Listener.CachedLocation, FAIStimulus::SensingFailed));
553 SightQueries.RemoveAtSwap(QueryIndex, 1,
false);
571 SCOPE_CYCLE_COUNTER(STAT_AI_Sense_Sight_RegisterTarget);
575 if (SightTarget !=
nullptr && SightTarget->
GetTargetActor() != &TargetActor)
583 else if (SightTarget ==
nullptr)
592 SightTarget->
TeamId = FGenericTeamId::GetTeamIdentifier(&TargetActor);
595 bool bNewQueriesAdded =
false;
596 AIPerception::FListenerMap& ListenersMap = *GetListeners();
599 const AVRBaseCharacter * VRChar = Cast<const AVRBaseCharacter>(&TargetActor);
600 const FVector TargetLocation = VRChar !=
nullptr ? VRChar->
GetVRLocation_Inline() : TargetActor.GetActorLocation();
602 for (AIPerception::FListenerMap::TConstIterator ItListener(ListenersMap); ItListener; ++ItListener)
604 const FPerceptionListener& Listener = ItListener->Value;
605 const IGenericTeamAgentInterface* ListenersTeamAgent = Listener.GetTeamAgent();
607 if (Listener.HasSense(GetSenseID()) && Listener.GetBodyActor() != &TargetActor)
610 if (FAISenseAffiliationFilter::ShouldSenseTeam(ListenersTeamAgent, TargetActor, PropDigest.
AffiliationFlags))
614 const bool bInRange = Importance > 0.0f;
627 OnAddedFunc(AddedQuery);
629 bNewQueriesAdded =
true;
635 if (bNewQueriesAdded)
637 RequestImmediateUpdate();
640 return bNewQueriesAdded;
645 UAIPerceptionComponent* NewListenerPtr = NewListener.Listener.Get();
646 check(NewListenerPtr);
647 const UAISenseConfig_Sight_VR* SenseConfig = Cast<const UAISenseConfig_Sight_VR>(NewListenerPtr->GetSenseConfig(GetSenseID()));
658 bool bNewQueriesAdded =
false;
659 const IGenericTeamAgentInterface* ListenersTeamAgent = Listener.GetTeamAgent();
660 const AActor* Avatar = Listener.GetBodyActor();
663 for (FTargetsContainer::TConstIterator ItTarget(
ObservedTargets); ItTarget; ++ItTarget)
665 const AActor* TargetActor = ItTarget->Value.GetTargetActor();
666 if (TargetActor == NULL || TargetActor == Avatar)
671 if (FAISenseAffiliationFilter::ShouldSenseTeam(ListenersTeamAgent, *TargetActor, PropertyDigest.
AffiliationFlags))
675 const bool bInRange = Importance > 0.0f;
681 AddedQuery.
ObserverId = Listener.GetListenerID();
682 AddedQuery.
TargetId = ItTarget->Key;
689 OnAddedFunc(AddedQuery);
691 bNewQueriesAdded =
true;
696 if (bNewQueriesAdded)
698 RequestImmediateUpdate();
704 SCOPE_CYCLE_COUNTER(STAT_AI_Sense_Sight_ListenerUpdate);
713 if (AsTarget != NULL)
715 if (AsTarget->
Target.IsValid())
718 TSet<FPerceptionListenerID> LastVisibleObservers;
723 LastVisibleObservers.Add(Query.ObserverId);
729 Query.bLastResult = LastVisibleObservers.Contains(Query.ObserverId);
738 const FPerceptionListenerID ListenerID = UpdatedListener.GetListenerID();
740 if (UpdatedListener.HasSense(GetSenseID()))
743 TSet<FAISightTargetVR::FTargetId> LastVisibleTargets;
748 LastVisibleTargets.Add(Query.TargetId);
752 const UAISenseConfig_Sight_VR* SenseConfig = Cast<const UAISenseConfig_Sight_VR>(UpdatedListener.Listener->GetSenseConfig(GetSenseID()));
773 bool bSkipListenerUpdate =
false;
774 const FPerceptionListenerID ListenerID = UpdatedListener.GetListenerID();
778 if (PropertiesDigest)
781 const UAISenseConfig_Sight_VR* SenseConfig = CastChecked<const UAISenseConfig_Sight_VR>(UpdatedListener.Listener->GetSenseConfig(GetSenseID()));
784 *PropertiesDigest = NewPropertiesDigest;
787 if (!bSkipListenerUpdate)
789 Super::OnListenerConfigUpdated(UpdatedListener);
808 SCOPE_CYCLE_COUNTER(STAT_AI_Sense_Sight_RemoveByListener);
815 const uint32 ListenerId = Listener.GetListenerID();
819 auto RemoveQuery = [&ListenerId, &OnRemoveFunc](TArray<FAISightQueryVR>& SightQueries,
const int32 QueryIndex)->
EReverseForEachResult
827 OnRemoveFunc(SightQuery);
829 SightQueries.RemoveAtSwap(QueryIndex, 1,
false);
848 SCOPE_CYCLE_COUNTER(STAT_AI_Sense_Sight_RemoveToTarget);
850 auto RemoveQuery = [&TargetId, &OnRemoveFunc](TArray<FAISightQueryVR>& SightQueries,
const int32 QueryIndex)->
EReverseForEachResult
854 if (SightQuery.
TargetId == TargetId)
858 OnRemoveFunc(SightQuery);
860 SightQueries.RemoveAtSwap(QueryIndex, 1,
false);
878 const uint32 ListenerId = Listener.GetListenerID();
879 const uint32 TargetId = ActorToForget.GetUniqueID();
883 if (SightQuery.ObserverId == ListenerId && SightQuery.TargetId == TargetId)
886 SightQuery.ForgetPreviousResult();
900 const uint32 ListenerId = Listener.GetListenerID();
904 if (SightQuery.ObserverId == ListenerId)
906 SightQuery.ForgetPreviousResult();
920UAISenseConfig_Sight_VR::UAISenseConfig_Sight_VR(
const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
922 DebugColor = FColor::Green;
923 AutoSuccessRangeFromLastSeenLocation = -1.0;
924 SightRadius = 3000.f;
925 LoseSightRadius = 3500.f;
926 PeripheralVisionAngleDegrees = 90;
927 DetectionByAffiliation.bDetectEnemies =
true;
928 Implementation = UAISense_Sight_VR::StaticClass();
936#if WITH_GAMEPLAY_DEBUGGER
937static FString DescribeColorHelper(
const FColor& Color)
939 int32 MaxColors = GColorList.GetColorsNum();
940 for (int32 Idx = 0; Idx < MaxColors; Idx++)
942 if (Color == GColorList.GetFColorByIndex(Idx))
944 return GColorList.GetColorNameByIndex(Idx);
948 return FString(TEXT(
"color"));
951void UAISenseConfig_Sight_VR::DescribeSelfToGameplayDebugger(
const UAIPerceptionComponent* PerceptionComponent, FGameplayDebuggerCategory* DebuggerCategory)
const
953 if (PerceptionComponent ==
nullptr || DebuggerCategory ==
nullptr)
958 FColor SightRangeColor = FColor::Green;
959 FColor LoseSightRangeColor = FColorList::NeonPink;
962 DebuggerCategory->AddTextLine(
963 FString::Printf(TEXT(
"%s: {%s}%s {white}rangeIN:{%s}%s {white} rangeOUT:{%s}%s"), *GetSenseName(),
964 *GetDebugColor().ToString(), *DescribeColorHelper(GetDebugColor()),
965 *SightRangeColor.ToString(), *DescribeColorHelper(SightRangeColor),
966 *LoseSightRangeColor.ToString(), *DescribeColorHelper(LoseSightRangeColor))
969 const AActor* BodyActor = PerceptionComponent->GetBodyActor();
970 if (BodyActor !=
nullptr)
972 FVector BodyLocation, BodyFacing;
973 PerceptionComponent->GetLocationAndDirection(BodyLocation, BodyFacing);
975 DebuggerCategory->AddShape(FGameplayDebuggerShape::MakeCylinder(BodyLocation,
LoseSightRadius, 25.0f, LoseSightRangeColor));
976 DebuggerCategory->AddShape(FGameplayDebuggerShape::MakeCylinder(BodyLocation,
SightRadius, 25.0f, SightRangeColor));
979 DebuggerCategory->AddShape(FGameplayDebuggerShape::MakeSegment(BodyLocation, BodyLocation + (BodyFacing * SightPieLength), SightRangeColor));
980 DebuggerCategory->AddShape(FGameplayDebuggerShape::MakeSegment(BodyLocation, BodyLocation + (BodyFacing.RotateAngleAxis(
PeripheralVisionAngleDegrees, FVector::UpVector) * SightPieLength), SightRangeColor));
981 DebuggerCategory->AddShape(FGameplayDebuggerShape::MakeSegment(BodyLocation, BodyLocation + (BodyFacing.RotateAngleAxis(-
PeripheralVisionAngleDegrees, FVector::UpVector) * SightPieLength), SightRangeColor));
static const int32 DefaultMaxTracesPerTick
EReverseForEachResult ReverseForEach(T &Array, const PREDICATE_CLASS &Predicate)
EForEachResult ForEach(T &Array, const PREDICATE_CLASS &Predicate)
DECLARE_CYCLE_STAT(TEXT("Perception Sense: Sight"), STAT_AI_Sense_Sight, STATGROUP_AI)
DEFINE_LOG_CATEGORY(LogAIPerceptionVR)
#define SIGHT_LOG_LOCATIONVR(...)
FORCEINLINE_DEBUGGABLE bool CheckIsTargetInSightPie(const FPerceptionListener &Listener, const UAISense_Sight_VR::FDigestedSightProperties &DigestedProps, const FVector &TargetLocation, const float SightRadiusSq)
static const int32 DefaultMinQueriesPerTimeSliceCheck
#define SIGHT_LOG_SEGMENTVR(...)
FVector GetVRLocation_Inline() const
void RemoveAllQueriesToTarget(const FAISightTargetVR::FTargetId &TargetId, const TFunction< void(const FAISightQueryVR &)> &OnRemoveFunc=nullptr)
virtual bool ShouldAutomaticallySeeTarget(const FDigestedSightProperties &PropDigest, FAISightQueryVR *SightQuery, FPerceptionListener &Listener, AActor *TargetActor, float &OutStimulusStrength) const
TArray< FAISightQueryVR > SightQueriesInRange
bool bSightQueriesOutOfRangeDirty
void RemoveAllQueriesByListener(const FPerceptionListener &Listener, const TFunction< void(const FAISightQueryVR &)> &OnRemoveFunc=nullptr)
float HighImportanceQueryDistanceThreshold
UPROPERTY(EditDefaultsOnly, Category = "AI Perception", config)
int32 MaxTracesPerTick
UPROPERTY(EditDefaultsOnly, Category = "AI Perception", config)
TMap< FPerceptionListenerID, FDigestedSightProperties > DigestedProperties
float CalcQueryImportance(const FPerceptionListener &Listener, const FVector &TargetLocation, const float SightRadiusSq) const
virtual void PostInitProperties() override
virtual void RegisterSource(AActor &SourceActors) override
virtual void OnListenerForgetsActor(const FPerceptionListener &Listener, AActor &ActorToForget) override
float MaxQueryImportance
UPROPERTY(EditDefaultsOnly, Category = "AI Perception", config)
TArray< FAISightQueryVR > SightQueriesOutOfRange
bool RegisterTarget(AActor &TargetActor, const TFunction< void(FAISightQueryVR &)> &OnAddedFunc=nullptr)
float SightLimitQueryImportance
UPROPERTY(EditDefaultsOnly, Category = "AI Perception", config)
double MaxTimeSlicePerTick
UPROPERTY(EditDefaultsOnly, Category = "AI Perception", config)
void OnListenerUpdateImpl(const FPerceptionListener &UpdatedListener)
void RegisterEvent(const FAISightEventVR &Event)
int32 NextOutOfRangeIndex
ECollisionChannel DefaultSightCollisionChannel
FTargetsContainer ObservedTargets
float HighImportanceDistanceSquare
virtual void UnregisterSource(AActor &SourceActor) override
virtual void OnListenerForgetsAll(const FPerceptionListener &Listener) override
void GenerateQueriesForListener(const FPerceptionListener &Listener, const FDigestedSightProperties &PropertyDigest, const TFunction< void(FAISightQueryVR &)> &OnAddedFunc=nullptr)
void OnListenerRemovedImpl(const FPerceptionListener &RemovedListener)
virtual float Update() override
virtual void OnListenerConfigUpdated(const FPerceptionListener &UpdatedListener) override
int32 MinQueriesPerTimeSliceCheck
UPROPERTY(EditDefaultsOnly, Category = "AI Perception", config)
void OnNewListenerImpl(const FPerceptionListener &NewListener)
UCLASS(meta = (DisplayName = "AI Sight VR config"))
float PeripheralVisionAngleDegrees
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Sense", config, meta = (UIMin = 0....
FAISenseAffiliationFilter DetectionByAffiliation
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Sense", config)
float LoseSightRadius
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Sense", config, meta = (UIMin = 0....
TSubclassOf< UAISense_Sight_VR > Implementation
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Sense", NoClear, config)
virtual TSubclassOf< UAISense > GetSenseImplementation() const override
float AutoSuccessRangeFromLastSeenLocation
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Sense", config)
float SightRadius
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Sense", config, meta = (UIMin = 0....
FAISightTargetVR::FTargetId TargetId
FPerceptionListenerID ObserverId
static const FTargetId InvalidTargetId
IAISightTargetInterface * SightTargetInterface
TWeakObjectPtr< AActor > Target
FORCEINLINE const AActor * GetTargetActor() const
FAISightTargetVR(AActor *InTarget=NULL, FGenericTeamId InTeamId=FGenericTeamId::NoTeam)
float PeripheralVisionAngleCos
FDigestedSightProperties()
float AutoSuccessRangeSqFromLastSeenLocation