Zum Hauptinhalt springen

facefound

facecontroller.facefound

Description

This event is emitted by Face Effects when a face is first found.

Event Properties

facecontroller.facefound.data : { id, transform, vertices, normals, attachmentPoints }

PropertyTypeDescription
idNumberA numerical id of the located face
transformTransformObjectTransform 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.

TransformObject

TransformObject is an object with the following properties: {position, rotation, scale, scaledWidth, scaledHeight, scaledDepth}

PropertyTypeDescription
position{x, y, z}The 3d position of the located face.
rotation{w, x, y, z}The 3d local orientation of the located face.
scaleNumberA scale factor that should be applied to objects attached to this face.
scaledWidthNumberApproximate width of the head in the scene when multiplied by scale.
scaledHeightNumberApproximate height of the head in the scene when multiplied by scale.
scaledDepthNumberApproximate depth of the head in the scene when multiplied by scale.

Example

ecs.registerComponent({
name: 'facefound',
add: (world, component) => {

const found = ({data}) => {
const {id, transform, vertices, normals, attachmentPoints, uvsInCameraFrame} = data
doSomething(id, transform, vertices, normals, attachmentPoints, uvsInCameraFrame)
}

world.events.addListener(world.events.globalId, 'facecontroller.facefound', found)
},
})