Represents a tracked image detected during a WebXR session. Contains position, rotation, and tracking state information for a detected marker image.

Properties:

  • Access image URL and physical dimensions
  • Get current position and rotation in world space
  • Check tracking state (tracked vs emulated)
  • Apply transform to 3D objects

Constructors

Properties

measuredSize: number

The measured size of the detected image in the real world. May differ from widthInMeters if the physical marker doesn't match the configured size.

state: "tracked" | "emulated"

Current tracking state of the image:

  • tracked - Image is currently being tracked by the system
  • emulated - Tracking is being emulated (less accurate)

Accessors

  • The WebXRImageTrackingModel configuration for this tracked image. Use this to access the assigned 3D object, marker settings, and other image tracking configuration. Available on each WebXRTrackedImage received from the image-tracking CustomEvent (event.detail).

    Returns WebXRImageTrackingModel

    tracker.addEventListener("image-tracking", event => {
    for (const img of event.detail.trackedImages) {
    const model = img.model;
    // Access the assigned 3D object
    const obj = model.object;
    // Access other settings
    console.log(model.widthInMeters, model.hideWhenTrackingIsLost);
    }
    });
  • get trackedModel(): undefined | AssetReference

    The 3D object or prefab assigned to this tracked image marker in the WebXRImageTrackingModel. Use this to access the object associated with an AR image tracking marker from the image-tracking CustomEvent. Shorthand for this.model.object.

    Returns undefined | AssetReference

    tracker.addEventListener("image-tracking", event => {
    for (const img of event.detail.trackedImages) {
    const obj = img.trackedModel;
    // verbose alternative: img.model.object
    }
    });
  • get url(): string

    URL of the tracked marker image

    Returns string

  • get widthInMeters(): number

    Physical width of the marker in meters

    Returns number

Methods

  • Apply the tracked image's position and rotation to a 3D object. Optionally applies smoothing to reduce jitter.

    Parameters

    • object: Object3D

      The 3D object to update

    • t01: undefined | number = undefined

      Interpolation factor (0-1) for smoothing. If undefined or >= 1, no smoothing is applied. When smoothing is enabled, larger position/rotation changes will automatically reduce the smoothing to prevent lag.

    Returns void

  • Copy the current world position of the tracked image to a Vector3.

    Parameters

    • vec: Vector3

      The vector to store the position in

    Returns Vector3

    The input vector with the position copied to it

  • Copy the current world rotation of the tracked image to a Quaternion.

    Parameters

    • quat: Quaternion

      The quaternion to store the rotation in

    Returns Quaternion

    The input quaternion with the rotation copied to it