RealDocs

APawn::PawnMakeNoise

function Engine Blueprint Since 4.0
#include "GameFramework/Pawn.h"
Access: public Specifiers: UFUNCTIONBlueprintCallableBlueprintAuthorityOnly

Description

Broadcasts a noise event to nearby AIControllers that have hearing enabled, sending them a HearNoise notification if the sound is within their hearing threshold. The pawn calling this function is always treated as the noise instigator.

Caveats & Gotchas

  • This function is BlueprintAuthorityOnly — it silently does nothing on clients. All noise generation for AI hearing must occur on the server.
  • Requires a UPawnNoiseEmitterComponent on either the pawn or its controller to propagate to hearing AI. Without one, the call is a no-op. Add one in the pawn's constructor if your game uses AI hearing.
  • NoiseMaker and the noise instigator (this pawn) are different concepts. NoiseMaker is the physical sound source; the instigator is the pawn responsible for the noise. Use NoiseMaker when, e.g., a thrown grenade lands — the grenade is the NoiseMaker, but the player pawn is the instigator.

Signature

void PawnMakeNoise(float Loudness, FVector NoiseLocation, bool bUseNoiseMakerLocation = true, AActor* NoiseMaker = nullptr)

Parameters

Name Type Description Default
Loudness float Relative loudness of the noise, range 0.0 to 1.0. Directly scales the hearing radius in the AI's HearingThreshold.
NoiseLocation FVector World-space position of the noise source. Pass FVector::ZeroVector to use the pawn's location.
bUseNoiseMakerLocation bool If true, uses the NoiseMaker actor's location rather than NoiseLocation. true
NoiseMaker AActor* The actor physically producing the noise. If null, the instigating pawn is used. Distinct from the noise instigator (this pawn). nullptr

Return Type

void

Example

Emit a footstep noise when landing C++
void AMyPawn::OnLanded(const FHitResult& Hit)
{
	// Loudness proportional to fall velocity
	float FallSpeed = FMath::Abs(GetVelocity().Z);
	float Loudness = FMath::Clamp(FallSpeed / 1200.f, 0.f, 1.f);
	PawnMakeNoise(Loudness, FVector::ZeroVector, false, nullptr);
}

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.