-
Notifications
You must be signed in to change notification settings - Fork 8
PlayerOcclusionStrategy
Guribo edited this page Jul 11, 2026
·
2 revisions
Packages/tlp.udonvoiceutils/Runtime/Core/PlayerAudio/PlayerOcclusion/PlayerOcclusionStrategy.cs
Abstract base class for occlusion behavior — determines how much audio is muffled by obstacles.
PlayerOcclusionStrategy defines how the system calculates audio clarity when obstacles exist between the listener and a speaker. Two built-in implementations are provided:
| Strategy | Behavior |
|---|---|
| DefaultPlayerOcclusion | Raycast-based — muffles audio behind walls and players |
| NullPlayerOcclusion | Passthrough — no occlusion (full clarity always) |
- Add a strategy component to your scene (e.g.
DefaultPlayerOcclusion) - Assign it to the
PlayerOcclusionStrategyfield onTLP_PlayerAudioController - The controller uses this strategy for all player voice and avatar audio occlusion
To create a custom occlusion strategy:
- Create a new UdonSharp class extending
PlayerOcclusionStrategy - Override
GetAudioClarity— return a value between 0 and 1 (1 = full clarity, 0 = fully muffled) - Add the component to a GameObject in your scene
- Assign it to
PlayerAudioController.PlayerOcclusionStrategy
| Parameter | Description |
|---|---|
listenerHead |
World position of the local player's head |
listenerLookDirection |
Normalized direction the local player is facing |
distanceBetweenPlayerHeads |
Distance between listener and emitter heads |
environmentClarity |
Occlusion impact from environment obstacles (0-1) |
playerClarity |
Occlusion impact from other players (0-1) |
playerOcclusionMask |
Layer mask used for raycasting |
Returns: float 0-1 where 1 = no negative impact on clarity.
- DefaultPlayerOcclusion — the default raycast strategy
- NullPlayerOcclusion — passthrough (no occlusion)
- Occlusion — how occlusion works
- How to Set Up Occlusion — step-by-step setup
- Architecture
- Occlusion
- Voice Directionality
- Height Scaling
- Audio Processing Pipeline
- Private Voice Channels
- WorldAudio Subsystem
- WorldAudio Limitations
- Set Up Occlusion
- Set Up Voice Channels
- Set Up Reverb
- Set Up Height Scaling
- Set Up Voice Directionality
- Set Up Microphone
- Set Up WorldAudio Emitters
- Enable Debug Mode
- Tutorial #1: Custom Voice Override Zone
- Tutorial #2: Private Voice Channels
- Tutorial #3: Setting Up World Audio
- PlayerAudioController
- PlayerAudioOverride
- PlayerAudioOverrideList
- PlayerAudioView
- PlayerAudioConfigurationModel
- SyncedPlayerAudioConfigurationModel
- VoiceUtils
- IgnoredPlayers
- AudioObstacle
- DefaultPlayerOcclusion
- NullPlayerOcclusion
- PlayerOcclusionStrategy
- Privacy Channel Reference
- AdjustableGain
- DynamicPrivacy
- PickupMicrophone — MVC microphone system with MicModel/MicController/MicView
- VoiceOverrideTriggerZone
- VoiceOverrideRoom