Lens Scripting API
    Preparing search index...

    Class FaceRenderObjectProvider

    Mesh provider for a Face Mesh. Accessible through the control property on a Face Mesh RenderMesh.

    // @input Asset.RenderMesh faceMesh

    var weights = script.faceMesh.control.onExpressionWeightsUpdate.add(function(expWeights){
    // The passed in expressionWeights is a NamedValues: meaning it contains a names and values array. These two arrays correspond to each other.
    print(expWeights.names[0]); // Prints "EyeBlinkLeft"
    print(expWeights.values[0]); // Prints strength of EyeBlinkLeft expression
    });

    Hierarchy (View Summary)

    Index

    Properties

    earGeometryEnabled: boolean

    When true, ears will be included in the Face Mesh geometry.

    eyeCornerGeometryEnabled: boolean

    When true, a small area in the corners of the eyes will be included in the Face Mesh geometry.

    eyeGeometryEnabled: boolean

    When true, eyes will be included in the Face Mesh geometry.

    faceGeometryEnabled: boolean

    When true, the general face (not including eyes and mouth) will be included in the Face Mesh geometry.

    faceIndex: number

    Index of the face this FaceRenderObjectProvider mirrors.

    mouthGeometryEnabled: boolean

    When true, the mouth will be included in the Face Mesh geometry.

    onExpressionWeightsUpdate: event1<NamedValues, void>

    An event that will fire each time new expression weights are available.

    skullGeometryEnabled: boolean

    When true, the skull will be included in the Face Mesh geometry.

    The tracking context this effect is being applied to.

    In most cases, providers can be accessed via the control property of an asset.

    For example, we can jump to the last frame of an animated texture:

    // @input Asset.Texture myAnimatedTexture
    const myAnimatedTextureProvider = script.myAnimatedTexture.control;
    const frameCountOfTexture = myAnimatedTextureProvider.getFramesCount();
    myAnimatedTextureProvider.pauseAtFrame(frameCountOfTexture - 1);

    Or do it in TypeScript:

    @component
    export class ProviderExample extends BaseScriptComponent {
    @input()
    myAnimatedTexture: Texture;

    onAwake() {
    const myAnimatedTextureProvider = this.myAnimatedTexture.control as AnimatedTextureFileProvider;
    const frameCountOfTexture = myAnimatedTextureProvider.getFramesCount();
    myAnimatedTextureProvider.pauseAtFrame(frameCountOfTexture - 1);
    }
    }

    Methods

    • Returns a list of all expression names being tracked.

      Returns string[]

    • Returns the weight of the expression with the passed in name. See Expressions for valid expression names.

      Parameters

      • expressionName: string

      Returns number

    • Returns a Float32Array of all expression weights being tracked.

      Returns Float32Array

    • Returns true if the object matches or derives from the passed in type.

      Parameters

      • type: string

      Returns boolean