Skip to main content

Camera Events

Camera events are emitted on the world.events.globalId.

Events​

ACTIVE_CAMERA_CHANGE​

Emitted when the active camera changes.

Properties​

PropertyTypeDescription
cameraCameraThe active camera

Example​

defineState('initial-state').initial().listen(world.events.globalId, ecs.CameraEvents.ACTIVE_CAMERA_CHANGE, (event) => {
console.log('Active camera changed to: ', event.data.camera)
})

ACTIVE_CAMERA_EID_CHANGE​

Emitted when the active camera eid changes.

Properties​

PropertyTypeDescription
eideideid of the active camera

Example​

defineState('initial-state').initial().listen(world.events.globalId, ecs.CameraEvents.ACTIVE_CAMERA_EID_CHANGE, (event) => {
console.log('Active camera eid changed to: ', event.data.eid)
})

XR_CAMERA_EDIT​

Emitted when any XR attribute is changed on the active camera.

Properties​

PropertyTypeDescription
cameraCameraThe active camera

Example​

defineState('initial-state').initial().listen(world.events.globalId, ecs.CameraEvents.XR_CAMERA_EDIT, (event) => {
console.log('XR camera edited: ', event.data.camera)
})

XR_CAMERA_STOP​

Emitted when the XR camera stops.

Properties​

None.

Example​

defineState('initial-state').initial().listen(world.events.globalId, ecs.CameraEvents.XR_CAMERA_STOP, () => {
console.log('XR camera stopped')
})