Skip to main content

<pc-sounds>

The <pc-sounds> tag is used to define a sound component.

Usage

Attributes

AttributeTypeDefaultDescription
distance-modelEnum"linear"Distance attenuation model: "exponential" | "inverse" | "linear"
enabledBoolean"true"Enabled state of the component
max-distanceNumber"10000"Maximum distance for audio falloff
pitchNumber"1"Pitch multiplier for all sounds in this component
positionalFlag-Whether the sound is positional (3D spatial audio)
ref-distanceNumber"1"Reference distance for full volume
roll-off-factorNumber"1"Falloff rate factor for distance attenuation
volumeNumber"1"Master volume for all sounds in this component

Example

<pc-entity>
<pc-sounds>
<pc-sound asset="music"></pc-sound>
</pc-sounds>
</pc-entity>

JavaScript Interface

You can programmatically create and manipulate <pc-sounds> elements using the SoundComponentElement API.