Lens Scripting API

    Describes the API for the BaseHand, which is part of the API accessible by external developers.

    interface BaseHand {
        attachHandVisuals(handVisuals: HandVisuals): void;
        detachHandVisuals(handVisuals: HandVisuals): void;
        enabled: boolean;
        getFacingCameraAngle(): number;
        getHandVisuals(): HandVisuals;
        getPalmCenter(): vec3;
        getPalmPitchAngle(): number;
        getPinchDirection(): quat;
        getPinchStrength(): number;
        getSceneObject(): SceneObject;
        handType: "left" | "right";
        indexDistal: Keypoint;
        indexFinger: Keypoint[];
        indexIntermediate: Keypoint;
        indexKnuckle: Keypoint;
        indexMidJoint: Keypoint;
        indexPad: Keypoint;
        indexProximal: Keypoint;
        indexTip: Keypoint;
        indexToWrist: Keypoint;
        indexUpperJoint: Keypoint;
        isDominantHand: boolean;
        isFacingCamera(): boolean;
        isInTargetingPose(): boolean;
        isPinching(): boolean;
        isTapping(): PalmTapDetectionEvent;
        isTracked(): boolean;
        middleDistal: Keypoint;
        middleFinger: Keypoint[];
        middleIntermediate: Keypoint;
        middleKnuckle: Keypoint;
        middleMidJoint: Keypoint;
        middlePad: Keypoint;
        middleProximal: Keypoint;
        middleTip: Keypoint;
        middleToWrist: Keypoint;
        middleUpperJoint: Keypoint;
        objectTracking3D: ObjectTracking3D;
        onEnabledChanged: PublicApi<boolean>;
        onHandFound: PublicApi<void>;
        onHandLost: PublicApi<void>;
        onPhoneInHandBegin: PublicApi<void>;
        onPhoneInHandEnd: PublicApi<void>;
        onPinchCancel: PublicApi<void>;
        onPinchDown: PublicApi<void>;
        onPinchUp: PublicApi<void>;
        pinkyDistal: Keypoint;
        pinkyFinger: Keypoint[];
        pinkyIntermediate: Keypoint;
        pinkyKnuckle: Keypoint;
        pinkyMidJoint: Keypoint;
        pinkyPad: Keypoint;
        pinkyProximal: Keypoint;
        pinkyTip: Keypoint;
        pinkyToWrist: Keypoint;
        pinkyUpperJoint: Keypoint;
        points: Keypoint[];
        ringDistal: Keypoint;
        ringFinger: Keypoint[];
        ringIntermediate: Keypoint;
        ringKnuckle: Keypoint;
        ringMidJoint: Keypoint;
        ringPad: Keypoint;
        ringProximal: Keypoint;
        ringTip: Keypoint;
        ringToWrist: Keypoint;
        ringUpperJoint: Keypoint;
        setEnabled(isEnabled: boolean): void;
        setIsDominantHand(isDominantHand: boolean): void;
        targetingData: TargetingData;
        thumbBaseJoint: Keypoint;
        thumbDistal: Keypoint;
        thumbFinger: Keypoint[];
        thumbIntermediate: Keypoint;
        thumbKnuckle: Keypoint;
        thumbMidJoint: Keypoint;
        thumbPad: Keypoint;
        thumbProximal: Keypoint;
        thumbTip: Keypoint;
        thumbToWrist: Keypoint;
        wrist: Keypoint;
    }

    Implemented by

    Index

    Properties

    enabled: boolean

    Returns the enabled state of the hand.

    handType: "left" | "right"

    Determines if the hand is the left or right hand

    indexDistal: Keypoint

    The Keypoint of the indexDistal joint, will soon be

    for indexMidJoint

    indexFinger: Keypoint[]

    The Keypoints of the Index finger

    indexIntermediate: Keypoint

    The Keypoint of the indexIntermediate joint, will be

    soon in favor of indexKnuckle.

    indexKnuckle: Keypoint

    The Keypoint of the indexKnuckle joint (Index Metacarpophalangeal (MCP) Joint)

    indexMidJoint: Keypoint

    The Keypoint of the indexMidJoint joint (Index Proximal Interphalangeal (PIP) Joint)

    indexPad: Keypoint

    The Keypoint of the indexPad joint, will soon be

    for indexUpperJoint

    indexProximal: Keypoint

    The Keypoint of the indexProximal joint, will be

    soon in favor of indexToWrist.

    indexTip: Keypoint

    The Keypoint of the indexTip joint (Index Tip Joint)

    indexToWrist: Keypoint

    The Keypoint of the indexToWrist joint (Wrist Joint)

    indexUpperJoint: Keypoint

    The Keypoint of the indexUpperJoint joint (Index Distal Interphalangeal (DIP) Joint)

    isDominantHand: boolean

    Returns true if the hand is the dominant hand assigned by the system

    middleDistal: Keypoint

    The Keypoint of the middleDistal joint, will soon be

    for middleMidJoint

    middleFinger: Keypoint[]

    The Keypoints of the Middle finger

    middleIntermediate: Keypoint

    The Keypoint of the middleIntermediate joint, will be

    soon in favor of middleKnuckle.

    middleKnuckle: Keypoint

    The Keypoint of the middleKnuckle joint (Middle Metacarpophalangeal (MCP) Joint)

    middleMidJoint: Keypoint

    The Keypoint of the middleMidJoint joint (Middle Proximal Interphalangeal (PIP) Joint)

    middlePad: Keypoint

    The Keypoint of the middlePad joint, will soon be

    for middleUpperJoint

    middleProximal: Keypoint

    The Keypoint of the middleProximal joint, will be

    soon in favor of middleToWrist.

    middleTip: Keypoint

    The Keypoint of the middleTip joint (Middle Tip Joint)

    middleToWrist: Keypoint

    The Keypoint of the middleToWrist joint (Wrist Joint)

    middleUpperJoint: Keypoint

    The Keypoint of the middleUpperJoint joint (Middle Distal Interphalangeal (DIP) Joint)

    objectTracking3D: ObjectTracking3D

    ObjectTracking3D associated with this base hand

    onEnabledChanged: PublicApi<boolean>

    Event called when this hand gets enabled or disabled

    onHandFound: PublicApi<void>

    Event called when the hand is found by the system

    onHandLost: PublicApi<void>

    Event called when the hand is lost by the system

    onPhoneInHandBegin: PublicApi<void>

    Event called when the hand is holding a phone.

    onPhoneInHandEnd: PublicApi<void>

    Event called when the hand is not holding a phone.

    onPinchCancel: PublicApi<void>

    Event called when the user's pinch is canceled by the system.

    onPinchDown: PublicApi<void>

    Event called when the user has successfully pinched down.

    onPinchUp: PublicApi<void>

    Event called when the user has released pinching after they have successfully pinched down.

    pinkyDistal: Keypoint

    The Keypoint of the pinkyDistal joint, will soon be

    for pinkyMidJoint

    pinkyFinger: Keypoint[]

    The Keypoints of the Pinky finger

    pinkyIntermediate: Keypoint

    The Keypoint of the pinkyIntermediate joint, will be

    soon in favor of pinkyKnuckle.

    pinkyKnuckle: Keypoint

    The Keypoint of the pinkyKnuckle joint (Pinky Metacarpophalangeal (MCP) Joint)

    pinkyMidJoint: Keypoint

    The Keypoint of the pinkyMidJoint joint (Pinky Proximal Interphalangeal (PIP) Joint)

    pinkyPad: Keypoint

    The Keypoint of the pinkyPad joint, will soon be

    for pinkyUpperJoint

    pinkyProximal: Keypoint

    The Keypoint of the pinkyProximal joint, will be

    soon in favor of pinkyToWrist.

    pinkyTip: Keypoint

    The Keypoint of the pinkyTip joint (Pinky Tip Joint)

    pinkyToWrist: Keypoint

    The Keypoint of the pinkyToWrist joint (Wrist Joint)

    pinkyUpperJoint: Keypoint

    The Keypoint of the pinkyUpperJoint joint (Pinky Distal Interphalangeal (DIP) Joint)

    points: Keypoint[]

    The Keypoints of the entire Hand

    ringDistal: Keypoint

    The Keypoint of the ringDistal joint, will soon be

    for ringMidJoint

    ringFinger: Keypoint[]

    The Keypoints of the Ring finger

    ringIntermediate: Keypoint

    The Keypoint of the ringIntermediate joint, will be

    soon in favor of ringKnuckle.

    ringKnuckle: Keypoint

    The Keypoint of the ringKnuckle joint (Ring Metacarpophalangeal (MCP) Joint)

    ringMidJoint: Keypoint

    The Keypoint of the ringMidJoint joint (Ring Proximal Interphalangeal (PIP) Joint)

    ringPad: Keypoint

    The Keypoint of the ringPad joint, will soon be

    for ringUpperJoint

    ringProximal: Keypoint

    The Keypoint of the ringProximal joint, will be

    soon in favor of ringToWrist.

    ringTip: Keypoint

    The Keypoint of the ringTip joint (Ring Tip Joint)

    ringToWrist: Keypoint

    The Keypoint of the ringToWrist joint (Wrist Joint)

    ringUpperJoint: Keypoint

    The Keypoint of the ringUpperJoint joint (Ring Distal Interphalangeal (DIP) Joint)

    targetingData: TargetingData

    Returns the normalized direction and origin point of the targeting ray in world coordinate system It can return null if the data has not been received from LensCore's GestureModule API.

    thumbBaseJoint: Keypoint

    The Keypoint of the thumbBaseJoint joint (Thumb Carpometacarpal (CMC) Joint)

    thumbDistal: Keypoint

    The Keypoint of the thumbDistal joint, will soon be

    for thumbKnuckle

    thumbFinger: Keypoint[]

    The Keypoints of the Thumb finger

    thumbIntermediate: Keypoint

    The Keypoint of the thumbIntermediate joint, will be

    soon in favor of thumbBaseJoint.

    thumbKnuckle: Keypoint

    The Keypoint of the thumbKnuckle joint (Thumb Metacarpophalangeal (MCP) Joint)

    thumbMidJoint: Keypoint

    The Keypoint of the thumbMidJoint joint (Thumb Interphalangeal (IP) Joint)

    thumbPad: Keypoint

    The Keypoint of the thumbPad joint, will soon be

    for thumbMidJoint

    thumbProximal: Keypoint

    The Keypoint of the thumbProximal joint, will be

    soon in favor of thumbToWrist.

    thumbTip: Keypoint

    The Keypoint of the thumbTip joint (Thumb Tip Joint)

    thumbToWrist: Keypoint

    The Keypoint of the thumbToWrist joint (Wrist Joint)

    wrist: Keypoint

    The Keypoint of the wrist joint

    Methods

    • Returns the roll rotation of the hand in degrees. This is the result of the dot product from a right vector, created by the index and middle knuckle, and the camera's right vector to determine if the palm if facing the user.

      A value less than 30 is facing towards the user. A value greater than 30 is facing away from the user.

      Returns null if the hand is not being tracked.

      Returns number

    • Approximates the center of the palm, as we currently do not have a center palm landmark. Used to determine whether hands are overlapping

      Returns vec3

      the calculated center or null if any of the landmarks don't exist

    • Returns the pitch rotation of the hand in degrees. This is the result of the dot product from a forward vector, created by the middle knuckle and wrist, and the camera's forward vector.

      A value greater than 0 is pointing up. A value less than 0 is pointing down.

      Returns null if the hand is not being tracked.

      Returns number

    • Returns a direction quaternion based on a plane derived from a forward direction (between your thumb knuckle to thumb tip) and a right direction (between your thumb knuckle to index knuckle)

      Returns quat

    • Returns a normalized value from 0-1, where 0 is the distance from a finger tip to the thumb tip in resting/neutral hand pose. 1 is when a finger tip to thumb tip are touching/pinching. Returns null if the hand is not tracked

      Returns number

    • Determines if the hand's palm is facing the user

      Returns boolean

    • Determines if the hand is aiming towards objects in the scene

      Returns boolean

    • Determines if the user is pinching

      Returns boolean

    • Determines if the system is able to track the BaseHand

      Returns boolean

    • Sets the enabled state of the hand. Events will not be called if isEnabled is set to false.

      Parameters

      • isEnabled: boolean

      Returns void

    • Sets isDominantHand. This is used from HandInputData based on Lens Tweak value, and shouldn't be accessible by external developers.

      Parameters

      • isDominantHand: boolean

        describes if this hand is the dominant one or not

      Returns void

    MMNEPVFCICPMFPCPTTAAATR