Face Effects Events
Types
TransformObject
| Property | Type | Description |
|---|---|---|
| position | {x, y, z} | The 3d position of the located face. |
| rotation | {w, x, y, z} | The 3d local orientation of the located face. |
| scale | Number | A scale factor that should be applied to objects attached to this face. |
| scaledWidth | Number | Approximate width of the head in the scene when multiplied by scale. |
| scaledHeight | Number | Approximate height of the head in the scene when multiplied by scale. |
| scaledDepth | Number | Approximate depth of the head in the scene when multiplied by scale. |
Events
FACE_LOADING
This event is emitted by Face Effects when loading begins for additional face AR resources.
Properties
| Property | Type | Description |
|---|---|---|
| maxDetections | Number | The maximum number of faces that can be simultaneously processed. |
| pointsPerDetection | Number | Number of vertices that will be extracted per face. |
| indices | [{a, b, c}] | Indexes into the vertices array that form the triangles of the requested mesh, as specified with meshGeometry on configure. |
| uvs | [{u, v}] | uv positions into a texture map corresponding to the returned vertex points. |
Example
- .listen
- .onEvent
- .addEventListener
defineState('initial-state').initial().listen(world.events.globalId, ecs.events.FACE_LOADING, (event) => {
console.log('Face loading')
})
FACE_SCANNING
This event is emitted by Face Effects when all face AR resources have been loaded and scanning has begun.
Properties
| Property | Type | Description |
|---|---|---|
| maxDetections | Number | The maximum number of faces that can be simultaneously processed. |
| pointsPerDetection | Number | Number of vertices that will be extracted per face. |
| indices | [{a, b, c}] | Indexes into the vertices array that form the triangles of the requested mesh, as specified with meshGeometry on configure. |
| uvs | [{u, v}] | uv positions into a texture map corresponding to the returned vertex points. |
Example
- .listen
- .onEvent
- .addEventListener
defineState('initial-state').initial().listen(world.events.globalId, ecs.events.FACE_SCANNING, (event) => {
console.log('Face scanning')
})
FACE_FOUND
This event is emitted by Face Effects when a face is first found.
Properties
| Property | Type | Description |
|---|---|---|
| id | Number | A numerical id of the located face |
| transform | TransformObject | Transform information of the located face. |
| vertices | [{x, y, z}] | Position of face points, relative to transform. |
| normals | [{x, y, z}] | Normal direction of vertices, relative to transform. |
| attachmentPoints | { name, position: {x,y,z} } | See XR8.FaceController.AttachmentPoints for list of available attachment points. position is relative to the transform. |
| uvsInCameraFrame | [{u, v}] | The list of uv positions in the camera frame corresponding to the returned vertex points. |
Example
- .listen
- .onEvent
- .addEventListener
defineState('initial-state').initial().listen(world.events.globalId, ecs.events.FACE_FOUND, (event) => {
console.log('Face found')
})
FACE_UPDATED
This event is emitted by Face Effects when faces are subsequently found.
Properties
| Property | Type | Description |
|---|---|---|
| id | Number | A numerical id of the located face |
| transform | TransformObject | Transform information of the located face. |
| vertices | [{x, y, z}] | Position of face points, relative to transform. |
| normals | [{x, y, z}] | Normal direction of vertices, relative to transform. |
| attachmentPoints | { name, position: {x,y,z} } | See XR8.FaceController.AttachmentPoints for list of available attachment points. position is relative to the transform. |
| uvsInCameraFrame | [{u, v}] | The list of uv positions in the camera frame corresponding to the returned vertex points. |
Example
- .listen
- .onEvent
- .addEventListener
defineState('initial-state').initial().listen(world.events.globalId, ecs.events.FACE_UPDATED, (event) => {
console.log('Face updated: ', event.data.transform)
})
FACE_LOST
This event is emitted by Face Effects when a face is no longer being tracked.
Properties
| Property | Type | Description |
|---|---|---|
| id | Number | A numerical id of the face that was lost. |
Example
- .listen
- .onEvent
- .addEventListener
defineState('initial-state').initial().listen(world.events.globalId, ecs.events.FACE_LOST, (event) => {
console.log('Face lost')
})
FACE_BLINKED
This event is emitted by Face Effects when a tracked face's eyes blink.
Properties
| Property | Type | Description |
|---|---|---|
| id | Number | A numerical id of the located face |
Example
- .listen
- .onEvent
- .addEventListener
defineState('initial-state').initial().listen(world.events.globalId, ecs.events.FACE_BLINKED, (event) => {
console.log('Blinked')
})
FACE_INTERPUPILLARY_DISTANCE
This event is emitted by Face Effects when a tracked face's distance in millimeters between the centers of each pupil is first detected.
Properties
| Property | Type | Description |
|---|---|---|
| id | Number | A numerical id of the located face. |
| interpupillaryDistance | Number | Approximate distance in millimeters between the centers of each pupil. |
Example
- .listen
- .onEvent
- .addEventListener
defineState('initial-state').initial().listen(world.events.globalId, ecs.events.FACE_INTERPUPILLARY_DISTANCE, (event) => {
console.log('Interpupillary distance: ', event.data.interpupillaryDistance)
})
FACE_LEFT_EYEBROW_LOWERED
This event is emitted by Face Effects when a tracked face's distance in millimeters between the centers of each pupil is first detected.
Properties
| Property | Type | Description |
|---|---|---|
| id | Number | A numerical id of the located face. |
Example
- .listen
- .onEvent
- .addEventListener
defineState('initial-state').initial().listen(world.events.globalId, ecs.events.FACE_LEFT_EYEBROW_LOWERED, (event) => {
console.log('Left eyebrow lowered')
})