Preparing search index...

    Class AnchorComponent

    The active tracker: set its AnchorModule.Anchor and it drives its SceneObject's transform, reporting per-frame tracking state. Add this Component to the SceneObject you want anchored, then assign an Anchor obtained from an AnchorModule.AnchorSession.

    Lens Scripting Version 376

    const tracker = script.getSceneObject().createComponent(AnchorComponent.getTypeName());
    tracker.anchor = anchor; // an Anchor obtained from an AnchorSession
    tracker.onStateChanged.add((state) => {
    print("anchor tracking state: " + state);
    });

    Hierarchy (View Summary)

    Index

    Properties

    The anchor this component tracks. Set it to begin tracking; clear it (null) to stop.

    Lens Scripting Version 376

    null
    
    enabled: boolean

    If disabled, the Component will stop enacting its behavior.

    true
    
    isBeingDestroyed: boolean

    Returns true if this Component is currently being destroyed. Becomes true as soon as destruction begins via Component#destroy or destruction of its owning SceneObject, before any OnDestroyEvent callbacks fire.

    Lens Scripting Version 364

    if (!script.isBeingDestroyed) {
    // Component is still fully alive
    }
    isEnabledInHierarchy: boolean

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

    onPositionalUncertaintyChanged: event1<number, void>

    Called when the anchor's positional uncertainty changes. Roughly how accurate the tracked position is, in centimeters (~1σ).

    Lens Scripting Version 376

    onStateChanged: event1<AnchorTrackingState, void>

    Called when the anchor's tracking state changes (e.g. found or lost).

    Lens Scripting Version 376

    sceneObject: SceneObject

    The SceneObject this component is on.

    Whether the anchor is currently being tracked.

    Lens Scripting Version 376

    uniqueIdentifier: string

    Lens Scripting Version 176

    Methods

    • Destroys the component.

      Returns void

    • Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName().

      Returns string

      Lens Scripting Version 376

    • 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