UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
PawnSensingComponent.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
9#include "PawnSensingComponent.generated.h"
10
11class AActor;
12class AController;
13class APawn;
15
20class UE_DEPRECATED_FORGAME(5.5, "Pawn sensing is deprecated. AI Perception should be used instead.") UPawnSensingComponent;
21UCLASS(ClassGroup=AI, HideCategories=(Activation, "Components|Activation", Collision), meta=(BlueprintSpawnableComponent), MinimalAPI)
23{
25
27 DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams( FHearNoiseDelegate, APawn*, Instigator, const FVector&, Location, float, Volume);
28
30 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=AI)
31 float HearingThreshold;
32
34 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=AI)
36
38 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=AI)
39 float SightRadius;
40
42 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=AI)
43 float SensingInterval;
44
45 // Max age of sounds we can hear. Should be greater than SensingInterval, or you might miss hearing some sounds!
46 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=AI)
48
49public:
50
56 UFUNCTION(BlueprintCallable, BlueprintAuthorityOnly, Category="AI|Components|PawnSensing")
58
60 UFUNCTION(BlueprintCallable, BlueprintAuthorityOnly, Category="AI|Components|PawnSensing")
61 AIMODULE_API virtual void SetSensingUpdatesEnabled(const bool bEnabled);
62
64 UFUNCTION(BlueprintCallable, BlueprintAuthorityOnly, Category="AI|Components|PawnSensing")
66
67 UFUNCTION(BlueprintCallable, Category="AI|Components|PawnSensing")
68 float GetPeripheralVisionAngle() const;
69
70 UFUNCTION(BlueprintCallable, Category="AI|Components|PawnSensing")
71 float GetPeripheralVisionCosine() const;
72
74 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=AI)
76
78 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=AI)
80
82 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=AI)
84
89 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=AI)
91
94
97
99 AIMODULE_API virtual bool ShouldCheckVisibilityOf(APawn* Pawn) const;
100
106 AIMODULE_API virtual bool CouldSeePawn(const APawn* Other, bool bMaySkipChecks = false) const;
107
109 AIMODULE_API virtual bool ShouldCheckAudibilityOf(APawn* Pawn) const;
110
118
124
126 AIMODULE_API virtual bool CanHear(const FVector& NoiseLoc, float Loudness, bool bFailedLOS) const;
127
128 //~ Begin UActorComponent Interface.
129 AIMODULE_API virtual void InitializeComponent() override;
130 //~ End UActorComponent Interface.
131
134
137
139
141 AIMODULE_API virtual void SensePawn(APawn& Pawn);
142
144 AIMODULE_API virtual void OnTimer();
145
148
150 AIMODULE_API virtual void SetTimer(const float TimeDelay);
151
154
155 AIMODULE_API AActor* GetSensorActor() const; // Get the actor used as the actual sensor location is derived from this actor.
156 AIMODULE_API AController* GetSensorController() const; // Get the controller of the sensor actor.
157
158public:
160 UPROPERTY(BlueprintAssignable)
162
164 UPROPERTY(BlueprintAssignable)
166
168
169 // Broadcasts notification that our sensor sees a Pawn, using the OnSeePawn delegates.
170 AIMODULE_API virtual void BroadcastOnSeePawn(APawn& Pawn);
171
172 // Broadcasts notification that our sensor hears a noise made local to a Pawn's position, using the OnHearNoise delegates.
173 AIMODULE_API virtual void BroadcastOnHearLocalNoise(APawn& Instigator, const FVector& Location, float Volume);
174
175 // Broadcasts notification that our sensor hears a noise made remotely from a Pawn's position, using the OnHearNoise delegates.
176 AIMODULE_API virtual void BroadcastOnHearRemoteNoise(APawn& Instigator, const FVector& Location, float Volume);
177
179 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=AI)
181
183 UPROPERTY()
185};
186
187
188
190{
192}
193
194inline float UPawnSensingComponent::GetPeripheralVisionCosine() const
195{
197}
198
199
int Volume
Definition AndroidPlatformMisc.cpp:380
#define UE_DEPRECATED_FORGAME
Definition CoreMiscDefines.h:377
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(DelegateName, Param1Type, Param1Name, Param2Type, Param2Name, Param3Type, Param3Name)
Definition DelegateCombinations.h:71
#define DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(DelegateName, Param1Type, Param1Name)
Definition DelegateCombinations.h:53
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define UFUNCTION(...)
Definition ObjectMacros.h:745
#define GENERATED_UCLASS_BODY(...)
Definition ObjectMacros.h:768
#define UCLASS(...)
Definition ObjectMacros.h:776
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition Actor.h:257
Definition Controller.h:41
Definition ActorComponent.h:152
Definition PawnNoiseEmitterComponent.h:20
@ false
Definition radaudio_common.h:23
Definition TimerHandle.h:12