FaceTrackingModule Overview
FaceTrackingModule Overview


Exposes details and key points of a three-dimensionally tracked face.


// Move a plane between the left cheek and right eyebrow face points
// when tapped
// Project setup:
// - One plane: plane0
// Required project capabilities:
// - Face Tracking (auto added on FaceTracking module import)
// - Touch Gestures > Tap Gesture

// Load in the required modules
const Scene = require('Scene');
const FaceTracking = require('FaceTracking');
const TouchGestures = require('TouchGestures');

(async function () {  // Enables async/await in JS [part 1]

  // Locate the plane in the scene and the first detected face
  const [plane, face] = await Promise.all([

  // Get the left cheek and right eyebrow objects from the detected face
  const leftCheek = face.leftCheek;
  const rightEyebrow = face.rightEyebrow;

  // Create a boolean to track which face point the plane is currently tracked to
  var planeOnCheek = false;

  // Change the face point the plane is tracked to when the plane is tapped
  TouchGestures.onTap(plane).subscribe(() => {

    // If the plane is on the cheek, bind its position to the eyebrow
    if (planeOnCheek){

      plane.transform.x = face.cameraTransform.applyToPoint(rightEyebrow.outsideEnd).x;
      plane.transform.y = face.cameraTransform.applyToPoint(rightEyebrow.outsideEnd).y;

      planeOnCheek = false;

    // If the plane is on the eyebrow, bind its position to the cheek
    } else {
      plane.transform.x = face.cameraTransform.applyToPoint(leftCheek.cheekbone).x;
      plane.transform.y = face.cameraTransform.applyToPoint(leftCheek.cheekbone).y;

      planeOnCheek = true;


})(); // Enables async/await in JS [part 2]


(get) cameraTransform: TransformSignal
(set) (Not Available)

The face transform relative to the camera coordinate system, as a TransformSignal.
Calling cameraTransform.applyToPoint(point), where point is a point in the face's local coordinate system, will return a point in the camera's local coordinate system.
(get) chin: Chin
(set) (Not Available)

The Chin of the tracked face.
(get) forehead: Forehead
(set) (Not Available)

The Forehead of the tracked face.
(get) id: StringSignal
(set) (Not Available)

The unique ID assigned to a tracked face, as a StringSignal.
A unique ID is generated for every new face detected and tracked in the scene.

If a face loses tracking it will be assigned a new unique ID when it is tracked again - the effect will not recognise individual faces.
(get) isTracked: BoolSignal
(set) (Not Available)

Indicates whether the face is being tracked in the current frame, with a BoolSignal.
If false, the value of the Face object's properties represent their value during the frame they were most recently tracked in.
(get) leftCheek: Cheek
(set) (Not Available)

The left Cheek of the tracked face.
(get) leftEye: Eye
(set) (Not Available)

The left Eye of the tracked face.
(get) leftEyebrow: Eyebrow
(set) (Not Available)

The left Eyebrow of the tracked face.
(get) mouth: Mouth
(set) (Not Available)

The Mouth of the tracked face.
(get) nose: Nose
(set) (Not Available)

The Nose of the tracked face.
(get) rightCheek: Cheek
(set) (Not Available)

The right Cheek of the tracked face.
(get) rightEye: Eye
(set) (Not Available)

The right Eye of the tracked face.
(get) rightEyebrow: Eyebrow
(set) (Not Available)

The right Eyebrow of the tracked face.


point(u: ScalarSignal | number, v: ScalarSignal | number): PointSignal

Returns a PointSignal with the point in the face's local coordinate system that corresponds to the specified UV point from the facial mesh texture map.
Use the Face.cameraTransform() method to convert the point to the camera coordinate system.
* u - the U coordinate from the facial mesh texture map.
* v - the V coordinate from the facial mesh texture map.

Was this article helpful?