Audio: per-SoundEffect occlusion via Steam Audio + 3D flag refactor
- New occlusion opt-in on SoundEffect: spatialized instances get a SteamAudioSource with raycast occlusion + frequency-dependent transmission (walls muffle instead of hard-mute) - Replace SoundEffectDistanceRange asset indirection with an explicit _3d bool (user refactor); rolloff/distance now left to defaults - Hey.asset: occlusion enabled Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c25d0777c2
commit
706100e322
8 files changed
+21
-56
No files matched your search
@@ -23,16 +23,19 @@ namespace Prototype
|
||||
audioSource.volume = options.GetVolume();
|
||||
audioSource.pitch = options.GetPitch();
|
||||
|
||||
var range = options.GetDistanceRange();
|
||||
|
||||
audioSource.spatialBlend = range.x == 0 && range.y == 0 ? 0 : 1;
|
||||
audioSource.spatialBlend = options.Get3D() ? 1 : 0;
|
||||
audioSource.spatialize = options.GetSpatialize() && audioSource.spatialBlend > 0;
|
||||
audioSource.rolloffMode = AudioRolloffMode.Linear;
|
||||
audioSource.minDistance = range.x;
|
||||
audioSource.maxDistance = range.y;
|
||||
audioSource.loop = options.GetLoop();
|
||||
}
|
||||
|
||||
if (audioSource.spatialize && options.GetOcclusion())
|
||||
{
|
||||
var steamAudioSource = gameObject.AddComponent<SteamAudio.SteamAudioSource>();
|
||||
steamAudioSource.occlusion = true;
|
||||
steamAudioSource.transmission = true;
|
||||
steamAudioSource.transmissionType = SteamAudio.TransmissionType.FrequencyDependent;
|
||||
}
|
||||
|
||||
if (!options.ShouldDestroyOnLoad())
|
||||
{
|
||||
DontDestroyOnLoad(this);
|
||||
|
||||
Reference in new issue
Block a user