Represents a Wonderland audio listener component. Updates the position and orientation of a WebAudio listener instance.

Only one listener should be active at a time.

Hierarchy

  • Component
    • AudioListener

Properties

Properties: {} = {}

Properties of this component class.

Properties are public attributes that can be configured via the Wonderland Editor.

Example:

import { Component, Type } from '@wonderlandengine/api';
class MyComponent extends Component {
static TypeName = 'my-component';
static Properties = {
myBoolean: { type: Type.Boolean, default: false },
myFloat: { type: Type.Float, default: false },
myTexture: { type: Type.Texture, default: null },
};
}

Properties are automatically added to each component instance, and are accessible like any JS attribute:

// Creates a new component and set each properties value:
const myComponent = object.addComponent(MyComponent, {
myBoolean: true,
myFloat: 42.0,
myTexture: null
});

// You can also override the properties on the instance:
myComponent.myBoolean = false;
myComponent.myFloat = -42.0;

Reference types (i.e., mesh, object, etc...) can also be listed as required:

import {Component, Property} from '@wonderlandengine/api';

class MyComponent extends Component {
static Properties = {
myObject: Property.object({required: true}),
myAnimation: Property.animation({required: true}),
myTexture: Property.texture({required: true}),
myMesh: Property.mesh({required: true}),
}
}

Please note that references are validated once before the call to Component.start only, via the Component.validateProperties method.

TypeName: string = 'audio-listener'

Unique identifier for this component class.

This is used to register, add, and retrieve components of a given type.

Methods

  • Returns void

  • Returns void

  • Triggered when the component is started by the runtime, or activated.

    You can use that to re-initialize the state of the component.

    Returns void