Table of Contents

Introduction to the HMD extension package template

The com.easyar.sense.ext.hmdtemplate package provides examples and templates for HMD extension development. It is an implementation of the SDK and includes samples for application developers.

Template content

The package structure of this package follows the Unity recommended file layout:

.
├── CHANGELOG.md
├── Documentation~
├── Editor
├── LICENSE.md
├── package.json
├── Runtime
└── Samples~
    └── Combination_BasedOn_HMD

Some of the more important contents are as follows:

  • Runtime: The folder containing runtime platform assets. This is the most important folder in the template.
  • Samples~: The folder containing all samples in the package. It includes examples for downstream use and can serve as a demo for testing extensions. To develop this sample in place, the folder name needs to be changed to Samples. Using the Client.Pack method will automatically rename it to Samples~ when packing a new release.
  • Editor: The folder containing editor platform assets. The scripts in this folder are mainly used to create menu items.
  • package.json: The manifest file of the package.

Creation process of the template example

  1. Add AR Session

    In the Hierarchy view:

    • Right-click in an empty area, and add ARSession via the menu EasyAR Sense > Mega > AR Session (Mega Block Default Preset).
    • Select AR Session (EasyAR) and right-click, then add an ImageTrackerFrameFilter to the session via the menu EasyAR Sense > Image Tracking > Frame Filter : Image Tracker.
    • Select AR Session (EasyAR) and right-click, then add an DenseSpatialMapBuilderFrameFilter to the session via the menu EasyAR Sense > SpatialMap > Frame Filter : Dense SpatialMap Builder.
    • Select AR Session (EasyAR) and right-click, then add an SparseSpatialMapBuilderFrameFilter to the session via the menu EasyAR Sense > SpatialMap > Frame Filter : Sparse SpatialMap Builder.
    • Select AR Session (EasyAR) and right-click, then add and keep only the HMD Template FrameSource via the menu EasyAR Sense > Extensions > Frame Source : HMD Template (keep it only).

    alt text

  2. Add ImageTargetController

    In the Hierarchy view, right-click in an empty area, and add an ImageTargetController to the session via the menu EasyAR Sense > Image Tracking > Target : Image Target.

    Configure ImageTargetController:

    alt text

    After completing the above configuration, the image displayed in the Scene view is a gizmo. In this example, a quad is used to display the virtual object of the same image.

    Add a virtual object to display on the target:

    alt text

  3. Add a model as a reference for motion tracking origin

    This model is important for both developers and downstream users, as it is used to decouple device motion tracking from EasyAR algorithms.

    alt text

  4. Add UI for feature selection

    alt text

  5. Disable EasyAR features at startup and enable them via UI switches

    For example, the image tracking feature can be disabled at startup by setting the corresponding component's enable to false:

    alt text

    Then add UI switch handling:

    alt text