UE5 AI Distraction System with Hearing
UE5 AI Distraction System with Hearing
A basic enemy that only sees the player is fine for early testing, but it is not very interesting. The moment you add hearing and distractions, your AI starts feeling more like an actual guard instead of a moving collision problem.
In this tutorial, you will build a complete AI distraction system in Unreal Engine 5 using Blueprints. The player will throw a distraction object, that object will make a 3D sound and report a noise event on impact, and the enemy guard will react using AI Perception Hearing. The guard will investigate the sound location, and if nothing important happens after a short time, it will forget the event and return to normal behavior.
This is one of the core building blocks for stealth gameplay, guard behavior, suspicion systems, and dynamic enemy reactions.
Watch the video on YouTube: Unreal Engine 5 Enemy AI #4 – Build a Distraction System with Noise and AI Hearing
GitHub project: AIUnreal on GitHub
Full playlist: Enemy AI Blueprint Series Playlist
Subscribe for more Unreal Engine tutorials: Rambod YouTube Channel
What You Will Build
- A throwable distraction object created inside Unreal Engine
- A sound cue with 3D attenuation for realistic audio
- An input action to throw the distraction object
- A Blueprint actor that reports a noise event on impact
- An enemy AI that uses AI Perception Hearing
- Logic for moving toward the noise source
- Forgetting logic so the enemy eventually returns to patrol
Everything in this tutorial is done in Blueprint. No C++ is required.
Why a Distraction System Matters
Hearing-based AI makes enemy behavior less predictable and more useful for gameplay. Without it, enemies either see the player or do nothing. That gets shallow fast.
With a distraction system, the player can:
- throw an object to lure guards away
- create noise to test enemy awareness
- open a path through stealth gameplay
- create more interesting situations than simple chase behavior
On the AI side, hearing adds a second sensory channel beyond sight. That is a huge upgrade for stealth and tactical design.
How the Full System Works
The complete setup works in this order:
- The player presses a throw input.
- A throwable actor is spawned in front of the character.
- The throwable uses Projectile Movement to travel forward.
- When it hits something, it plays a 3D sound.
- The same impact also calls Report Noise Event.
- The enemy AI hears the noise through AI Perception Hearing.
- The enemy moves to the noise location.
- If nothing else happens, the noise is forgotten after its perception age expires.
- The enemy returns to normal behavior.
Once you understand that flow, you can extend it into rocks, bottles, shell casings, alarms, footsteps, or any other sound-based distraction.
Step 1: Create a Simple Throwable Mesh
Start by creating a distraction object. In the example workflow, this is done directly with Unreal Engine’s modeling tools instead of importing an outside mesh.
First, create a folder in your Content Drawer named:
3DModels
Then switch the editor mode from Selection to:
Modeling
In the Modeling panel, choose a:
Sphere
Set its radius to something small like:
10
and make sure the new asset location is set to the current folder so the generated mesh is saved inside your 3DModels folder.
Accept the mesh and rename it to something clean, such as:
MySphere
The exact name does not matter, but clean naming matters more than people think. Bad project naming becomes a real tax later.
Step 2: Add Collision to the Throwable Mesh
Open the new sphere mesh in the Static Mesh Editor.
In the toolbar, go to Collision and add:
Add Sphere Simplified Collision
This matters because your distraction object needs proper collision for physics interaction, hits, and overlap behavior.
Without collision, the ball may appear to move visually but fail to behave correctly in gameplay.
Step 3: Create the Throw Input Action
Now set up the input that lets the player throw the distraction object.
In your Input folder, inside the Actions subfolder, create a new Input Action named:
IA_Throw
Open it and make sure the Value Type is:
Digital (bool)
This means it behaves like a normal pressed button.
Next, open your Input Mapping Context, usually something like:
IMC_Default
Add a mapping for IA_Throw and bind it to a key such as:
Q
The exact key is your choice. Q works fine for testing.
Step 4: Import and Prepare the Sound Effect
The distraction object should not only physically hit the world. It also needs to sound like it hit the world.
Create an Audio folder in the root of your Content folder and import your sound file there.
Unreal works best with formats like WAV and OGG for this type of workflow. MP3 is not the right default choice here.
After importing the sound, right-click it and create:
Create Cue
This creates a Sound Cue, which gives you more control than using the raw sound file directly.
Step 5: Enable 3D Audio with Attenuation
Open the Sound Cue.
In the details or cue settings, enable:
Override Attenuation
This makes the sound behave like a sound source in the world instead of sounding flat and global.
You can later tune:
- inner radius
- falloff distance
- volume behavior
For now, the important point is that the distraction noise should feel like it comes from the impact location.
Step 6: Create the Throwable Blueprint
In your Blueprints folder, create a new Blueprint Class based on:
Actor
Name it something like:
BP_Throwable
This actor will represent the distraction object that is spawned, thrown, collides, makes sound, and reports noise to the AI system.
Step 7: Add Components to BP_Throwable
Open BP_Throwable and add:
- Static Mesh
- Projectile Movement
Drag the Static Mesh on top of the DefaultSceneRoot so it becomes the new root component.
That matters because the mesh is the physical object moving through the world.
Step 8: Configure the Static Mesh Component
Select the Static Mesh component and assign your previously created sphere mesh.
Configure it like this:
- Collision Presets: BlockAll
- Simulate Physics: Off
- Enable Gravity: On
Why disable Simulate Physics? Because in this setup the Projectile Movement component handles the motion. If you mix uncontrolled projectile movement with physics in the wrong way, you can get messy behavior.
Step 9: Configure Projectile Movement
Select the Projectile Movement component.
Set values such as:
- Initial Speed: 1000
- Max Speed: 10000
- Should Bounce: enabled
- Simulation Enabled: enabled
- Initial Velocity in Local Space: disabled
Initial Velocity in Local Space is turned off here so the projectile direction behaves more predictably with your throw direction setup.
These values are only starting points. You should tune them based on how heavy or light you want the distraction throw to feel.
Why Projectile Movement Is a Good Fit Here
Projectile Movement is useful because it handles travel, gravity, bounce, and velocity more cleanly than trying to manually update the object every frame.
For a distraction object like this, it gives you a believable thrown arc without unnecessary custom math.
Step 10: Add Impact Logic with Event Hit
In BP_Throwable, go to the Event Graph and add:
Event Hit
This fires when the ball collides with something.
The goal is:
- avoid false hits against the player controller logic path
- make sure the sound and noise event only happen once
- play the sound at the impact location
- report the noise to AI Perception
Step 11: Prevent Noise Spam with Do Once
After filtering out invalid or unwanted hit cases, add a:
Do Once
This is important because the ball may bounce several times. Without Do Once, the same throw could generate repeated noise reports and sound spam every time the object touches something.
For a simple distraction mechanic, one clean noise event is usually enough.
Step 12: Play Sound at the Impact Location
Add:
Play Sound at Location
Use your Sound Cue as the sound asset and the Event Hit location as the location.
This makes the distraction feel grounded in the world. The sound plays exactly where the object lands.
Step 13: Report the Noise Event
Right after the impact sound, add:
Report Noise Event
Configure it like this:
- Noise Location: Hit Location
- Loudness: 1.0
- Max Range: 0 or your desired value
- Tag: Ball
- Instigator: Player Controller reference used in the setup
The tag matters because later in the AI logic you will distinguish hearing events caused by the ball from other perception events.
The instigator helps Unreal know who was responsible for the noise, which becomes useful in more advanced AI systems.
Step 14: Add a Debug Print
For easy testing, add a:
Print String
with a message like:
We made some noise
Set the print color to something obvious like red.
During AI work, debug feedback saves time. You want quick proof that the event happened before blaming AI Perception.
Step 15: Add a Spawn Point to the Character
Open your character Blueprint, such as:
BP_ThirdPersonCharacter
Add an:
Arrow Component
Use it as the spawn point for the throwable.
Example location:
X = 60
Y = 50
Z = 60
This just gives the ball a spawn position slightly in front of the character.
You can later attach it to a hand socket or another cleaner point, but for a fast Blueprint workflow this is enough.
Step 16: Spawn the Throwable from the Throw Input
In the character Event Graph, add your:
IA_Throw
event.
From there, use:
Spawn Actor from Class
Set the class to:
BP_Throwable
Set Collision Handling Override to:
Always Spawn, Ignore Collisions
This avoids spawn failures if the object begins too close to the player.
Feed in the Arrow Component’s world transform as the spawn transform.
Step 17: Set the Throwable Velocity
After spawning the ball, get its Projectile Movement component and call:
Set Velocity
To generate the velocity:
- Get the character’s forward vector
- Multiply it by a float speed value
- Use the result as the projectile velocity
Example throw speed:
2000
This means the ball launches in the direction the character is facing.
If you want the throw to arc more or go farther, adjust the speed and projectile settings together.
Step 18: Add AI Hearing to the Enemy Guard
Open:
BP_EnemyGuard
Select the AI Perception component.
In Senses Config, add:
AI Hearing
Configure it so the guard can detect relevant sound sources.
Important settings:
- Detect Neutrals: enabled
- Detect Friendlies: enabled if appropriate for your setup
- Hearing Range: tuned for your gameplay
- Max Age: around 5 seconds or more
Max Age controls how long the AI remembers the hearing stimulus.
Why Max Age Matters
Max Age is one of the most important settings here.
If the enemy hears a distraction but never forgets it, the system feels wrong. If it forgets too fast, the reaction feels useless.
A value like 5 seconds gives the guard enough time to investigate, then lose interest if nothing else happens.
Step 19: Break the AI Stimulus Data
In BP_EnemyGuard, go to the perception reaction logic and use:
Break AIStimulus
This gives you access to information about what the AI sensed, including:
- stimulus location
- tag
- success state
- other perception details
The tag is the key part for this distraction system.
Step 20: Separate Ball Noise from Sight Logic
Since your throwable reports noise using the tag:
Ball
compare the stimulus tag against that value.
Use a Branch setup so:
- non-ball stimuli continue through the normal sight logic
- ball-tagged stimuli go into the investigate-noise logic
This is a very important design point. You do not want hearing and sight mixed together in one messy path with no separation.
Step 21: Move the Enemy to the Noise Location
For the ball-noise branch, use:
AI Move To
Configure it like this:
- Pawn: Self
- Destination: Stimulus Location
Now, when the enemy hears the distraction, it moves toward the location where the sound was reported.
That gives you the core investigate behavior.
Step 22: Fix the Forgetting Logic
If you previously had forgetting logic that assumed only the player could be forgotten, remove any unnecessary cast to the player character from:
On Target Perception Forgotten
Noise events are not always tied to the player character directly. If your forgetting logic still tries to cast everything to the player, it can fail or behave incorrectly.
Instead, let the forgotten event directly restore the guard’s normal patrol or movement speed behavior.
Step 23: Refresh Enemy Instances in the Level
After changing the enemy Blueprint, remove old placed guard instances from the level and drag in fresh ones.
This is a practical debugging step. Sometimes old placed actors can keep stale assumptions during rapid testing, especially if your Blueprint setup changed significantly.
Clean test conditions matter.
How the Final Behavior Should Feel
In the final setup:
- the player presses Q to throw the distraction object
- the object travels forward and hits the environment
- it plays a 3D ball-drop sound
- it reports a noise event tagged as Ball
- the enemy hears it and moves to investigate
- if the enemy does not find anything important, it forgets the noise after the hearing stimulus expires
- the guard returns to normal behavior
That is a real stealth gameplay building block, not just a tech demo trick.
Why Tagging the Noise Event Is Smart
The Ball tag is a simple but important architectural choice.
It allows you to distinguish different sound sources later.
For example, later you could add:
- Footstep
- Gunshot
- Explosion
- Alarm
- Bottle
- Door
Then the enemy can react differently depending on what kind of sound was heard.
Common Problem: AI Does Not React to the Noise
If the enemy does not move:
- check that AI Hearing was added in AI Perception
- check the hearing detection affiliation settings
- check that Report Noise Event is firing
- check that the noise tag matches your comparison logic
- check that the enemy can actually path to the stimulus location
- check that the sound event is reported once and not blocked by the wrong condition
Use Print String and visual debugging. Do not guess.
Common Problem: The Ball Makes Noise Multiple Times
If the ball keeps triggering sound and hearing events every time it bounces, your Do Once logic is missing, disconnected, or bypassed.
For a simple distraction object, one noise event per throw is usually the correct behavior.
Common Problem: The Enemy Never Forgets
If the guard keeps acting like the noise still matters forever:
- check the Hearing Max Age value
- check the forgotten event logic
- check that the AI is not immediately receiving another stimulus
Forgetting is just as important as hearing. Without it, the AI feels stuck.
Common Problem: The Throw Direction Feels Wrong
If the ball spawns correctly but flies in a strange direction:
- check the Arrow Component orientation
- check that you are using the character’s forward vector correctly
- check projectile speed values
- check whether local-space projectile velocity is disabled
Most of the time, this is a transform or direction-vector issue.
How to Expand This System Later
Once this works, you can evolve it into a much stronger stealth system by adding:
- different distraction objects with different loudness values
- multiple sound tags for different reactions
- suspicion states before full investigation
- animations when the guard hears something
- line-of-sight checks at the investigation point
- return-to-patrol behavior trees
- hearing-based detection combined with sight-based chase logic
This is exactly why modular AI systems matter. One clean hearing setup can expand into much richer gameplay.
Conclusion
In this tutorial, you built a complete distraction system in Unreal Engine 5 using Blueprints. You created a throwable object, added 3D sound, reported a noise event on impact, configured AI Hearing Perception, made the enemy investigate the stimulus location, and fixed the forgetting logic so the guard returns to normal behavior later.
This gives your enemy AI a real hearing-based reaction system and opens the door for stealth gameplay, distractions, and smarter guard behavior.
Watch the full tutorial on YouTube: Unreal Engine 5 Enemy AI #4 – Build a Distraction System with Noise and AI Hearing
Subscribe for more Unreal Engine tutorials: Subscribe to Rambod on YouTube
Resources
Frequently Asked Questions
How do I make AI hear sounds in Unreal Engine 5?
Add AI Hearing to the AI Perception component, then call Report Noise Event from the source of the sound and react to the hearing stimulus in your AI Blueprint logic.
Why use Report Noise Event instead of only playing a sound?
Playing a sound is for the player experience. Report Noise Event is for AI Perception. The enemy does not react to audio playback automatically unless you report the noise stimulus.
Why should the throwable use a tag like Ball?
Tags help separate different kinds of perception stimuli so you can react differently to footsteps, gunshots, thrown objects, or other sound sources later.
Why does the AI only react once per throw?
A Do Once node is used so the distraction object reports noise only one time even if it bounces multiple times.
How does the AI forget the distraction?
The Hearing Max Age setting controls how long the stimulus is remembered. After that, the On Target Perception Forgotten logic can return the enemy to normal behavior.
Can I use this system for stealth games?
Yes. This is exactly the kind of Blueprint setup used as a foundation for stealth distraction mechanics, guard investigation behavior, and sound-based player manipulation.
Continue Unreal Engine 5 Enemy AI Series – Beginner Blueprint Tutorials
Back to Unreal Engine 5 Enemy AI Series – Beginner Blueprint Tutorials playlist • Lesson 4 of 12
Recommended resource
Recommended for this tutorial
Useful tools selected for this workflow topic.