Whether to autoplay the sound.
The inner angle of the audio cone.
The outer angle of the audio cone.
The outer gain of the audio cone.
The distance model used for spatial audio.
Readonly
emitterThe emitter will notify all subscribers when a state change occurs.
Set this property if the object will never move. Disabling position updates each frame saves CPU time.
Whether to loop the sound.
The maximum distance for audio falloff.
The reference distance for audio falloff.
The rolloff factor for audio falloff.
Select the panning method.
Path to the audio file that should be played.
Volume of the audio source.
Static
TypeThe type name for this component.
Checks if the audio src is currently playing.
Static
onCalled when this component class is registered.
This callback can be used to register dependencies of a component, e.g., component classes that need to be registered in order to add them at runtime with Object3D.addComponent, independent of whether they are used in the editor.
class Spawner extends Component {
static TypeName = 'spawner';
static onRegister(engine) {
engine.registerComponent(SpawnedComponent);
}
// You can now use addComponent with SpawnedComponent
}
This callback can be used to register different implementations of a component depending on client features or API versions.
// Properties need to be the same for all implementations!
const SharedProperties = {};
class Anchor extends Component {
static TypeName = 'spawner';
static Properties = SharedProperties;
static onRegister(engine) {
if(navigator.xr === undefined) {
/* WebXR unsupported, keep this dummy component */
return;
}
/* WebXR supported! Override already registered dummy implementation
* with one depending on hit-test API support */
engine.registerComponent(window.HitTestSource === undefined ?
AnchorWithoutHitTest : AnchorWithHitTest);
}
// This one implements no functions
}
Represents an audio src in the Wonderland Engine, allowing playback of audio files.