From 4c63a5e5dda3efa1e96fdb7f5a8d83c7561afe7b Mon Sep 17 00:00:00 2001 From: MelekTaus Moribundus Date: Sun, 12 Jul 2026 00:26:01 +0200 Subject: [PATCH] Audio: radar taunt at head height + Steam Audio source tuning - MatchManager: taunt positions resolve the FirstPersonTarget child instead of the player root (shared TauntPosition helper, root fallback) - SoundEffectInstance: physics-based distance attenuation + raycast occlusion on runtime SteamAudioSource Co-Authored-By: Claude Fable 5 --- Assets/Scripts/Audio/SoundEffectInstance.cs | 3 +++ Assets/Scripts/Network/MatchManager.cs | 11 +++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/Audio/SoundEffectInstance.cs b/Assets/Scripts/Audio/SoundEffectInstance.cs index 3322b53..f313daa 100644 --- a/Assets/Scripts/Audio/SoundEffectInstance.cs +++ b/Assets/Scripts/Audio/SoundEffectInstance.cs @@ -31,7 +31,10 @@ namespace Prototype if (audioSource.spatialize && options.GetOcclusion()) { var steamAudioSource = gameObject.AddComponent(); + steamAudioSource.distanceAttenuation = true; + steamAudioSource.distanceAttenuationInput = SteamAudio.DistanceAttenuationInput.PhysicsBased; steamAudioSource.occlusion = true; + steamAudioSource.occlusionType = SteamAudio.OcclusionType.Raycast; steamAudioSource.transmission = true; steamAudioSource.transmissionType = SteamAudio.TransmissionType.FrequencyDependent; } diff --git a/Assets/Scripts/Network/MatchManager.cs b/Assets/Scripts/Network/MatchManager.cs index dfe992a..9f88e23 100644 --- a/Assets/Scripts/Network/MatchManager.cs +++ b/Assets/Scripts/Network/MatchManager.cs @@ -1241,7 +1241,7 @@ public class MatchManager : MonoBehaviour reader.ReadValueSafe(out ulong netObjId); if (spawnMgr == null || !spawnMgr.SpawnedObjects.TryGetValue(netObjId, out var no) || !no) continue; if (spawnBlips && radar) radar.Spawn(no.transform, lifetime); - _radarSoundPositions.Add(no.transform.position); + _radarSoundPositions.Add(TauntPosition(no.transform)); } PlayStaggeredPingTaunts(); } @@ -1256,10 +1256,17 @@ public class MatchManager : MonoBehaviour _radarSoundPositions.Clear(); for (int i = 0; i < _radarPingIds.Count; i++) if (spawnMgr.SpawnedObjects.TryGetValue(_radarPingIds[i], out var no) && no) - _radarSoundPositions.Add(no.transform.position); + _radarSoundPositions.Add(TauntPosition(no.transform)); PlayStaggeredPingTaunts(); } + // Taunts play at head height (the player's FirstPersonTarget child) rather than the root at the feet. + private static Vector3 TauntPosition(Transform player) + { + Transform t = player.Find("FirstPersonTarget"); + return t ? t.position : player.position; + } + // Plays the ping taunt at every staged position - staggered, never simultaneous. The same sample starting // at several world positions in the same audio frame phase-cancels, so each instance is delayed by its // distance to the local audio listener at the speed of sound (natural propagation: far players are heard