you are an Unreal Engine expert and technical sound designer who has worked on numerous AAA games, you know very well Unreal Engines documentation and you always check if you response corresponds to actual UE features. In Blueprints I'm building a system that mimics Portals from Wwise. I have a Source Bus emitter at the door in the building and the outside 2d ambience is transmitted to it. I also want 3d sounds, which are randomli spawned around the player to be routed to this source bus, however I don't want all of them being routed only those who are spawned within a debug sphere. Help me to create a logic that will check whether given sound is being spawned within this sphere. It should be a BP function that can be re-used in other BP
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Absolutely, I can help you with that. In Unreal Engine Blueprints, you can create a reusable Blueprint Function Library that checks whether a given sound emitter's location (or any actor's location) is within a debug sphere that you define (e.g., by center and radius).
This function can be called from any Blueprint to determine if a sound should be routed to your "Portal" source bus (similar to Wwise's concept).
✅ Goal Recap:
You want a Blueprint function that:
Takes a sound location (e.g., FVector or Actor)
Checks if it's within a debug sphere (defined by center and radius)
Returns true/false indicating whether the sound should be routed to the portal bus
🛠️ Step-by-Step Blueprint Function Implementation
1. Create a Blueprint Function Library
In the Content Browser, right-click → Blueprint Class → Choose BlueprintFunctionLibrary
Name it something like BPFL_SoundPortalUtils
2. Add the Function to the Library
Open BPFL_SoundPortalUtils
Click Add New → Function, name it IsLocationWithinPortalSphere
3. Define the Function Signature
Inputs:
InLocation – FVector (the location of the sound emitter)
SphereCenter – FVector (center of the sphere)
SphereRadius – Float (radius of the sphere)
Outputs:
ReturnValue – Boolean (true if inside the sphere)
4. Implement the Logic
In the function's graph:
Get Distance BetweenInLocation and SphereCenter using the Vector Distance node.
Compare the result to SphereRadius using a Less Than or Equal node.
Return the result as ReturnValue.
Here's how the Blueprint logic should look:
code
InLocation (FVector)
|
V
Vector - Vector (Subtract)
|
V
Vector Length
|
V
<= SphereRadius (Float)
|
V
Set ReturnValue (Boolean)
Alternatively, you can use the Distance node directly:
text
InLocation → (pin) A of "Distance (Vector)" node
SphereCenter → (pin) B
5. (Optional) Overload for Actor Input
To make it more flexible, create a second function called IsActorWithinPortalSphere:
Input: Actor (Actor Reference)
Use Get Actor Location to extract the FVector
Call the original IsLocationWithinPortalSphere function internally
🎯 Usage in Your Portal System
In your Blueprint where you spawn 3D ambient sounds:
After spawning the sound (or sound emitter actor), get its location.
Get the portal sphere's center and radius (could be a variable or exposed parameter).
Call IsLocationWithinPortalSphere to check if it's in range.
If true → route to the Portal Source Bus (you can use RTPC or switch buses via Sound Control in BP or with audio modulation if you're using the Synth Subsystem or Audio Mixer).
🧪 Debug Visualization (Optional)
If you want to visualize the portal sphere in the editor:
Add a Draw Debug Sphere node in your Blueprint or in a level script.
Set the center, radius, and duration (e.g., 0.05f for persistent)
Helps you see which sounds are being included
📦 Final Notes
This function is fully reusable across Blueprints.
You can extend it to support multiple spheres or dynamic portals.
Works with any actor or sound emitter that has a world location.
Would you like me to provide a sample Blueprint image or a downloadable .uasset for the function library?
User
how the actual Portal in Wwise handles outside sound directionality?
Assistant
Great question! Understanding how Wwise's Portal works is key to mimicking its behavior in Unreal Engine Blueprints, especially when it comes to directionality and spatialization of sounds coming from "outside" the player's current room or area.
🧠 How Wwise Portal Handles Outside Sound Directionality
In Wwise, a Portal is used in the context of Rooms and Acoustics, particularly when working with Wwise Spatial Audio (which integrates with the Reflect or Wwise SoundSeed Geometry plugins, or other integrations like Phonon or Steam Audio).
🎯 The Role of a Portal:
A Portal connects two Rooms together, allowing the audio engine to:
Simulate sound transmission through openings (like windows or doorways)
Handle early reflections and occlusion based on geometry
Provide spatial directionality of sound coming from another room
🎧 Directionality of Sounds Outside the Portal
When a sound is outside the player's current room, and there's a Portal connecting to that room:
🔊 1. 3D Panning / Directionality:
The sound is not fully localized as if it were in the same room
Instead, it is spatialized as if it's coming from the Portal's location
This gives the listener a sense of direction — the sound seems to come from the portal (e.g., a doorway), not from the actual emitter's position
🔇 2. Occlusion / Transmission:
The sound is attenuated based on the material of the portal or connecting geometry
This simulates sound passing through walls, doors, etc.
📏 3. Distance-Based Roll-off:
The distance used for attenuation is typically:
From the listener to the Portal (not the actual sound source)
Sometimes a blended distance is used based on the path through the portal
This gives a smooth transition as the player approaches or enters the room.
🧱 How to Mimic This in Unreal Engine Blueprints
Since you're trying to mimic Wwise Portal behavior, here's how to replicate the directionality part:
✅ 1. Route Sound to a "Portal" Audio Component
Create a dedicated Audio Component (or an Ambient Sound Actor) at the Portal's location (e.g., a door)
When a sound is determined to be outside the player’s room but within a portal sphere, route its audio output to this component
✅ 2. Use the Portal's Location for Spatialization
Instead of playing the sound from its original location:
Use the Portal's world location as the emitter position
You can do this by:
Spawning a temporary sound at the portal
Or by modifying the attenuation settings to use a custom spatialization point
✅ 3. Apply Custom Attenuation (Optional)
To simulate the occlusion through the portal, apply:
A gain reduction (e.g., via a Sound Mix or RTPC)
Or use audio modulation to dynamically adjust volume based on material type or portal openness
✅ 4. Smooth Transition Between Inside/Outside
As the player moves closer to or through the portal:
Blend between the original sound location and the portal location
This avoids abrupt changes in direction and volume
You can use a fading curve based on distance to the portal to interpolate between the two.
Returns the portal's location (or a blend of emitter and portal)
Then, use this function to:
Spawn the sound at the portal
Or drive a custom attenuation node in the sound cue
🧪 Optional: Use Directional Sound with Portal as Reflector
If you're using Audio2D/3D panning and want to simulate directionality more accurately:
Use the portal location as the virtual emitter
Let the engine handle HRTF or speaker panning naturally
This will give the player the illusion that the sound is coming from the doorway, not from the original 3D location.
📚 Summary
Wwise Portal Behavior
Unreal Engine Equivalent
Sound appears to come from the portal
Play sound from portal's location
Directionality based on listener-to-portal
Use portal's location as emitter
Distance roll-off based on portal path
Use portal distance or blend with real distance
Occlusion through portal
Apply gain or modulation based on portal material
Would you like a Blueprint example of how to dynamically switch between real and portal-based emitter location, or how to smoothly interpolate between them as the player approaches the portal?