Description
The OcclusionTags
property of the Sandbox.Audio.Mixer
class represents a set of tags that determine which objects in the game world can occlude sound. This property is used to define the physics-based occlusion behavior for audio sources managed by the mixer.
Usage
To use the OcclusionTags
property, you can assign a TagSet
that specifies the tags of objects that should occlude sound. This is useful for creating realistic audio environments where certain objects block or dampen sound based on their tags.
Ensure that the OverrideOcclusion
property is set to true
if you want the mixer to use custom occlusion tags instead of inheriting them from a parent mixer.
Example
// Example of setting OcclusionTags for a Mixer
var mixer = new Sandbox.Audio.Mixer();
// Create a new TagSet and add tags
var occlusionTags = new TagSet();
occlusionTags.Add("Wall");
occlusionTags.Add("Door");
// Assign the TagSet to the OcclusionTags property
mixer.OcclusionTags = occlusionTags;
// Ensure the mixer uses its own occlusion settings
mixer.OverrideOcclusion = true;