Skip to main content

VPS Events

Types

LocationObject

PropertyTypeDescription
idStringAn id for this Project Location that is stable within a session
nameStringProject Location name.
imageUrlStringURL to a representative image for this Project Location.
titleStringProject Location title.
latNumberLatitude of this Project Location.
lngNumberLongitude of this Project Location.

PositionAttributeObject

PropertyTypeDescription
nameStringThe object name
arrayFloat32Array()The raw mesh geometry data.
itemSizeIntegerThe number of items in the object

ColorAttributeObject

PropertyTypeDescription
nameStringThe object name
arrayFloat32Array()The raw mesh geometry data.
itemSizeIntegerThe number of items in the object

GeometryObject

PropertyTypeDescription
indexStringAn id for this mesh that is stable within a session.
attributes[PositionAttributeObject, ColorAttributeObject]The raw mesh geometry data.

Events

REALITY_LOCATION_FOUND

This event is emitted when a Project Location is first found.

Properties

PropertyTypeDescription
nameStringThe Project Location name.
position{x, y, z}The 3d position of the located Project Location.
rotation{w, x, y, z}The 3d local orientation (quaternion) of the located Project Location.

Example

defineState('initial-state').initial().listen(world.events.globalId, ecs.events.REALITY_LOCATION_FOUND, (event) => {
console.log('Location found: ', event.data.name)
})

REALITY_LOCATION_LOST

This event is emitted when a Project Location is no longer being tracked.

Properties

PropertyTypeDescription
nameStringThe Project Location name.
position{x, y, z}The 3d position of the located Project Location.
rotation{w, x, y, z}The 3d local orientation (quaternion) of the located Project Location.

Example

defineState('initial-state').initial().listen(world.events.globalId, ecs.events.REALITY_LOCATION_LOST, (event) => {
console.log('Location lost: ', event.data.name)
})

REALITY_LOCATION_SCANNING

This event is emitted when all Project Locations have been loaded for scanning.

Properties

PropertyTypeDescription
locationsArray<LocationObject>An array of objects containing Location information

Example

defineState('initial-state').initial().listen(world.events.globalId, ecs.events.REALITY_LOCATION_SCANNING, (event) => {
console.log('Locations scanning: ', event.data.locations)
})

REALITY_MESH_FOUND

This event is emitted when a mesh is first found either after start or after a recenter().

Properties

PropertyTypeDescription
idStringAn id for this mesh that is stable within a session.
position{x, y, z}The 3d position of the located Project Location.
rotation{w, x, y, z}The 3d local orientation (quaternion) of the located Project Location.
geometryGeometryObjectAn object containing raw mesh geometry data. Attributes contain position and color attributes.

Example

defineState('initial-state').initial().listen(world.events.globalId, ecs.events.REALITY_MESH_FOUND, (event) => {
console.log('Mesh found: ', event.data.id)
})

REALITY_MESH_LOST

This event is emitted when recenter() is called.

Properties

PropertyTypeDescription
idStringAn id for this mesh that is stable within a session.

Example

defineState('initial-state').initial().listen(world.events.globalId, ecs.events.REALITY_MESH_LOST, (event) => {
console.log('Mesh lost: ', event.data.id)
})