① Image Tracking
① Collider Trigger
The tutorial is for another tutorial <AR Portal>‘s final chapter, based on ARFoundation’s Image Tracking feature and Place on Plane.
① Image Tracking
Make sure you have installed ARFoundation and ARKit if you have a iOS device or ARCore if you are using an Andorid device, and created AR Session and AR Session Origin.
- AR Session Origin>Add Component>AR Tracked Image Manager;
- In Assets, create>XR>Reference Image Library;
- In Reference eImage Library, Add image and choose your target image, set a simple short name like “Card” but “TargetReferenceImage” (I have met some strange problem that Image Tracking not works with long name, and still don’t know the reason);
- Drag Reference Image Library into AR Session Origin>AR Tracked Image Manager>Serialized Library;
- Click ReferenceImageLibrary>Specify Size;
- Set the physical size (let the device know the ratio of the size between Digital Object and Real Objecy);

- Drag the prefab you wanna show when the target image is tracked into AR Session Origin>AR Tracked Image Manager>Tracked Image Prefab.

※Tips:
- Create a plane with a material using your target image as a reference to locate your model, set the plane as the physcial size(the default size of a plane is x=1 y=1 z=1, each 1 is 10 metre);
- Place your models on the ideal location to your target image (now it’s the plane you have just created);
- Create an empty GameObject and set the postion to 0,0,0;
- Drag your models as the child of the GameObject;
- Set the GameObject as the prefab you used as Tracked Image Prefab.
② Collider Trigger

This method can not only used for Image Tracking but any method that you can have something moved by your hand (AR Camera, Object Tracking or Gesture Tracking).
- Your Tracked Image Object, Add Component>Box Collider and adjust to a good form (fit your interaction’s needs);
- Click Box Collider>Is Trigger;

- Your digital object in the scene used for interacting, Add Component>Box Collider and adjust as well;
- The same object, Add Component>RigidBody;
- Unclick RigidBody “Use Gravity” and click “Is Kinematic”.

- Drag this script “ObjectDoorController.cs” into your digital object;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ObjectDoorController : MonoBehaviour
{
private void OnTriggerEnter(Collider other)
{
OpenClose(); //The function you wanna active when the collider is triggered;
}
public void OpenClose() //The function
{
Animator anim = this.GetComponentInChildren<Animator>();
anim.SetTrigger("OpenClose");
}
}
There are 3 ways of the collider interaction, I have linked on the titles: