VPS Events
Types
LocationObject
| Property | Type | Description |
|---|---|---|
| id | String | An id for this Project Location that is stable within a session |
| name | String | Project Location name. |
| imageUrl | String | URL to a representative image for this Project Location. |
| title | String | Project Location title. |
| lat | Number | Latitude of this Project Location. |
| lng | Number | Longitude of this Project Location. |
PositionAttributeObject
| Property | Type | Description |
|---|---|---|
| name | String | The object name |
| array | Float32Array() | The raw mesh geometry data. |
| itemSize | Integer | The number of items in the object |
ColorAttributeObject
| Property | Type | Description |
|---|---|---|
| name | String | The object name |
| array | Float32Array() | The raw mesh geometry data. |
| itemSize | Integer | The number of items in the object |
GeometryObject
| Property | Type | Description |
|---|---|---|
| index | String | An 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
| Property | Type | Description |
|---|---|---|
| name | String | The 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
- .listen
- .onEvent
- .addEventListener
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
| Property | Type | Description |
|---|---|---|
| name | String | The 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
- .listen
- .onEvent
- .addEventListener
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
| Property | Type | Description |
|---|---|---|
| locations | Array<LocationObject> | An array of objects containing Location information |
Example
- .listen
- .onEvent
- .addEventListener
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
| Property | Type | Description |
|---|---|---|
| id | String | An 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. |
| geometry | GeometryObject | An object containing raw mesh geometry data. Attributes contain position and color attributes. |
Example
- .listen
- .onEvent
- .addEventListener
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
| Property | Type | Description |
|---|---|---|
| id | String | An id for this mesh that is stable within a session. |
Example
- .listen
- .onEvent
- .addEventListener
defineState('initial-state').initial().listen(world.events.globalId, ecs.events.REALITY_MESH_LOST, (event) => {
console.log('Mesh lost: ', event.data.id)
})