Skip to content

Audio Zone

Updated

Inside the box, only sounds in the same zone are heard.

Type
comp-audio-zone
Script class
AudioZoneComponent
Per entity
One
Version
1.0.0

Read about it in Spatial audio: what it does, how to use it from a script, and examples.

The props the runtime declares for this component, with their defaults and accepted ranges.

Prop Default Range
halfExtents.x 0 ≤ x ≤ 10000
halfExtents.y 0 ≤ x ≤ 10000
halfExtents.z 0 ≤ x ≤ 10000

Sent to the entity’s Signal Emitter as { entityId, eventType, data }. Compare eventType with the EventType constants.

  • AudioZone::enter
  • AudioZone::exit

Run it in the browser, read its scripts, and download it as an XR Creator project.

#pragma lifecycle(startup)
function startup() {
const component = self.parent.getComponent(AudioZoneComponent);
if (component) log(component.props);
}