Taos API Reference
    Preparing search index...

    Class XrAnchors

    WebXR anchors helper. An anchor is a point the AR runtime keeps locked to the real world across frames, correcting for drift as its room model improves — so virtual objects placed on a table stay on the table. Without an anchor, content fixed in reference-space coordinates slowly slides as tracking refines.

    Create anchors from an XrHitTest result (placement on a real surface) or from an arbitrary pose, then call update every XRFrame and read each entry's matrix to position the corresponding object. Requires a session created with the 'anchors' feature.

    Part of the AR half of the WebXR integration — see TODO/webxr-integration.md.

    Index

    Constructors

    Properties

    onLost: ((entry: XrAnchorEntry) => void) | null = null

    Fired when an anchor stops being tracked and is pruned.

    Accessors

    Methods

    • Anchor an explicit pose in a given space (defaults to the session reference space). Needs the current XRFrame because createAnchor lives on it.

      Parameters

      • frame: XRFrame
      • pose: XRRigidTransform
      • space: XRSpace = ...

      Returns Promise<XrAnchorEntry | null>

    • Refresh every anchor's matrix from its tracked space, and prune anchors the runtime has dropped (no longer in frame.trackedAnchors). Call once per XRFrame.

      Parameters

      • frame: XRFrame

      Returns void