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 <noreply@anthropic.com>
This commit is contained in:
1 parent
7f18dc82f6
commit
4c63a5e5dd
2 files changed
+12
-2
No files matched your search
@@ -31,7 +31,10 @@ namespace Prototype
|
||||
if (audioSource.spatialize && options.GetOcclusion())
|
||||
{
|
||||
var steamAudioSource = gameObject.AddComponent<SteamAudio.SteamAudioSource>();
|
||||
steamAudioSource.distanceAttenuation = true;
|
||||
steamAudioSource.distanceAttenuationInput = SteamAudio.DistanceAttenuationInput.PhysicsBased;
|
||||
steamAudioSource.occlusion = true;
|
||||
steamAudioSource.occlusionType = SteamAudio.OcclusionType.Raycast;
|
||||
steamAudioSource.transmission = true;
|
||||
steamAudioSource.transmissionType = SteamAudio.TransmissionType.FrequencyDependent;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user