Camera Events
Camera events are emitted on the world.events.globalId.
Events
ACTIVE_CAMERA_CHANGE
Emitted when the active camera changes.
Properties
| Property | Type | Description |
|---|---|---|
| camera | Camera | The active camera |
Example
- .listen
- .onEvent
- .addEventListener
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
| Property | Type | Description |
|---|---|---|
| eid | eid | eid of the active camera |
Example
- .listen
- .onEvent
- .addEventListener
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
| Property | Type | Description |
|---|---|---|
| camera | Camera | The active camera |
Example
- .listen
- .onEvent
- .addEventListener
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.