Lens Scripting API
    Preparing search index...

    Class ObjectTracking

    Used to track objects in 2D space, such as body parts, pet, hand.

    Moves the local ScreenTransform to match the detected image.

    Object Tracking guide. @seeHand Gestures guide.

    // @input Component.ObjectTracking objectTracking

    script.objectTracking.onObjectFound = function() {
    print("Object has been found!");
    };

    script.objectTracking.onObjectLost = function() {
    print("Object has been lost!");
    };
    // @input Component.ObjectTracking  handTracking

    var descriptor = "open";
    // All possible descriptors for Hand Tracking are:
    // "victory", "open", "index_finger", "horns", "close", "thumb"

    script.handTracking.registerDescriptorStart(descriptor, function () {
    print(descriptor + " gesture was detected!");
    });

    Hierarchy (View Summary)

    Index

    Properties

    autoEnableWhenTracking: boolean

    If true, child objects of this Component's SceneObject will be disabled when the object is not being tracked.

    enabled: boolean

    If disabled, the Component will stop enacting its behavior.

    isEnabledInHierarchy: boolean

    Returns true if this Component, its SceneObject, and all of that SceneObjects parents are enabled.

    objectIndex: number

    The index of the object being tracked.

    objectSpecificData: ObjectSpecificData

    Gets additional data of the current object being tracked.

    onObjectFound: () => void

    Function that gets called when the tracked object is found.

    onObjectLost: () => void

    Function that gets called when the tracked object is lost.

    sceneObject: SceneObject

    The SceneObject this component is on.

    uniqueIdentifier: string

    Methods

    • Destroys the component.

      Returns void

    • Returns the name of this object's type.

      Returns string

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

      Parameters

      • type: string

      Returns boolean

    • Returns true if this object is the same as other. Useful for checking if two references point to the same thing.

      Parameters

      Returns boolean

    • Returns true if the object is currently being tracked on camera.

      Returns boolean

    • Registers a callback to be executed when the passed in descriptor ends for this tracked object. For example, the possible descriptors for hand tracking are: "victory", "open", "index_finger", "horns", "close", "thumb".

      Parameters

      • descriptor: string
      • callback: (descriptor: string) => void

      Returns void

    • Registers a callback to be executed when the passed in descriptor starts for this tracked object. For example, the possible descriptors for hand tracking are: "victory", "open", "index_finger", "horns", "close", "thumb".

      Parameters

      • descriptor: string
      • callback: (descriptor: string) => void

      Returns void