General Events
Events
ACTIVE_SPACE_CHANGE
Emitted when the world loads a Space (no promise of the Space being loaded).
Properties
None.
Example
world.events.addListener(world.events.globalId, ecs.events.ACTIVE_SPACE_CHANGE, () => {
console.log('Active space change');
});
LOCATION_SPAWNED
Emitted when a VPS Location is spawned on the map.
Properties
Property | Type | Description |
---|---|---|
id | string | The unique identifier for the location |
imageUrl | string | The location image |
title | string | The location title |
lat | number | Latitude of the location |
lng | number | Longitude of the location |
mapPoint | Eid | The spawned map point entity to parent your content under |
Example (Global)
world.events.addListener(world.events.globalId, ecs.events.LOCATION_SPAWNED, ({data}) => {
console.log(data)
})
Example (Entity Specific)
world.events.addListener(mapEid, ecs.events.LOCATION_SPAWNED, ({data}) => {
console.log(data)
})
GLTF_ANIMATION_FINISHED
Emitted when all loops of an animation clip have finished.
Properties
Property | Type | Description |
---|---|---|
name | string | The name of the animation |
Example (Global)
world.events.addListener(world.events.globalId, ecs.events.GLTF_ANIMATION_FINISHED, (properties) => {
console.log(properties.name);
});
Example (Entity Specific)
world.events.addListener(component.eid, ecs.events.GLTF_ANIMATION_FINISHED, (properties) => {
console.log(properties.name);
});
GLTF_ANIMATION_LOOP
Emitted when a single loop of the animation clip has finished.
Properties
Property | Type | Description |
---|---|---|
name | string | The name of the animation |
Example (Global)
world.events.addListener(world.events.globalId, ecs.events.GLTF_ANIMATION_LOOP, (properties) => {
console.log(properties.name);
});
Example (Entity Specific)
world.events.addListener(component.eid, ecs.events.GLTF_ANIMATION_LOOP, (properties) => {
console.log(properties.name);
});
GLTF_MODEL_LOADED
Emitted when a model has loaded
Properties
Property | Type | Description |
---|---|---|
name | string | The name of the model |
Example (Global)
world.events.addListener(world.events.globalId, ecs.events.GLTF_MODEL_LOADED, (properties) => {
console.log(properties.name);
});
Example (Entity Specific)
world.events.addListener(component.eid, ecs.events.GLTF_MODEL_LOADED, (properties) => {
console.log(properties.name);
});
SPLAT_MODEL_LOADED
Emitted when a Splat has loaded
Properties
Property | Type | Description |
---|---|---|
model | SplatModel | The Splat model |
Example (Global)
world.events.addListener(world.events.globalId, ecs.events.SPLAT_MODEL_LOADED, (model: SplatModel) => {
console.log(model);
});
Example (Entity Specific)
world.events.addListener(component.eid, ecs.events.GLTF_MODEL_LOADED, (model: SplatModel) => {
console.log(model);
});
AUDIO_CAN_PLAY_THROUGH
Emitted when an entity has the capability to play Audio.
Properties
None
Example
world.events.addListener(component.eid, ecs.events.AUDIO_CAN_PLAY_THROUGH, () => {
console.log(`${component.eid} can now play audio.`);
});
AUDIO_END
Emitted when audio has finished playing on an entity.
Properties
None
Example
world.events.addListener(component.eid, ecs.events.AUDIO_END, () => {
console.log(`${component.eid} finished playing audio.`);
});