Skip to content

Image Target

An AR image-tracking anchor. Children of an image-target entity are revealed and aligned when the tracker recognizes the printed image at runtime.

ts
import { Behaviour } from "@relu-interactives/spatial-ecs";

export default class SpawnTarget extends Behaviour {
  init() {
    const objects = this.world.getObjectManagementSystem();
    objects?.requestCreate("imageTarget", {
      name: "PosterTarget",
      path: "/assets/targets/poster.png",
      options: {
        compiledTargetUrl: "/assets/targets/poster.mind",
      },
    }, (entityId) => {
      // Parent renderable content under the target so it shows when tracked.
      objects?.requestCreate("model", {
        name: "Reveal",
        path: "/assets/models/reveal.glb",
        parentId: entityId,
      });
    });
  }
}

Payload

FieldTypeDefaultDescription
namestring"Image Target"Display name.
pathstring""URL of the source image used as a visual reference in the editor.
transformTransformDataidentityPosition / rotation / scale (usually left at identity — the tracker drives the transform).
parentIdEntityId | nullnullOptional parent entity.

options

OptionTypeDescription
targetsImageTargetReference[]Optional list of target references when bundling multiple images into one compiled file.
compiledTargetUrlstringURL to the compiled .mind file used by the tracker.
compiledTargetDirstringOptional directory containing compiled target files.

Components attached

Transform, Object3DRef, Name, EntityType, ParentId, Selectable, ImageTarget, ImageTargetAnchor.