Skip to main content
Version: 5.x

Object Tracking

Object Tracking allows you to attach 2D images and animations to certain objects found in the scene. Object Tracking currently supports the detection and tracking of a Cat, Dog, Cat and Dog, Hand and Body. Object Tracking is able to, in real time, give you the screen space bounding box of the object found in the camera. Because of the 2D nature of the tracking, it works best for adding 2D images or animations to the tracked object. That said, you can also attach 3D objects to Object Tracking. See the Object Tracking and 3D Objects section below for more information on how to do this.

There are various examples of Object Tracking usage: Pet, HandShoulderSkeletal, Full Body Triggers, or Full Body Attachments.

 

 

 

Adding Object Tracking to your Project

Add Object Tracking

To add Object Tracking to your project, in the Scene Hierarchy panel, select + -> Tracking and the type of Object Tracking you'd like to use.

Select Preview Video

When working with Object Tracking, you'll want to switch the preview video to one with the object you're trying to track. In the Preview panel, press the Image / Video Mode button. Then, in the drop down at the top of the Preview panel, select the corresponding video under the Object Tracking category.

Configure Image

The child-most Object Tracking object represents the attached 2D Image. Select it in the Scene Hierarchy panel to tune it in the Inspector panel. double-click on the object to open the 2D Editor panel to help you position it visually.

In the Inspector panel, open the Material inline-editor by pressing the settings button next to the field, and set the Texture field to an imported 2D image or animation.

Then, in the 2D Editor panel, you can position, scale and rotate your attached 2D content with the bounding box handles.

Configure Attachment Point

The parent Object Tracking object represents the actual tracking. Select it in the Scene Hierarchy panel to tune it in the Inspector panel.

In the Inspector panel, you can adjust the tracked point via the Attachment Point dropdown.

Types of Object Tracking

Cat

Tracks a single Cat found in the camera.

Available Attachment Points: Center, Left Eye, Right Eye, Nose

Dog

Tracks a single Dog found in the camera.

Available Attachment Points: Center, Left Eye, Right Eye, Nose

Cats and Dogs

Tracks either a single Cat or single Dog found in the camera. Applies the same content to either.

Available Attachment Points: Center, Left Eye, Right Eye, Nose

Hand

Tracks a single hand found in the camera.

Available Attachment Points: center, 4 joints on every finger, and 3 joints on the wrist

You can also use hand tracking to track joints on a person’s hand. Great for creating experiences that involves details on the hand, or to create custom hand gestures.

Take a look at 3D Body and Hand Tracking which is another way to track the hand.

Shoulder

Tracks a person's shoulder and neck. Detects and tracks when the person is medium to far away from the camera, making it distinct from face and skeletal tracking.

Available Attachment Points: Center, Left Shoulder, Right Shoulder

Upper Body

Tracks specific joints on a person’s upper body. Detects and tracks when the person is far away from the camera, making it distinct from face and shoulder tracking. Great for creating rear camera experiences that interact with a person.

Available Attachment Points: Head, Neck, Left Shoulder, Right Shoulder, Left Elbow, Right Elbow, Left Wrist, Right Wrist

Full Body

Tracks specific joints on a person’s full body. Detects and tracks when the person is even farther away from the camera, making it distinct from face, shoulder, and upper body tracking. Great for creating experiences that involves the whole body like a dance.

Available Attachment Points: Nose, Left Eye, Right Eye, Left Ear, Right Ear, Neck, Left Shoulder, Right Shoulder, Left Elbow, Right Elbow, Left Wrist, Right Wrist, Left Hip, Right Hip, Left Knee, Right Knee, Left Ankle, Right Ankle

Object Tracking & 3D Objects

Take a look at the Object Tracking 3D guide, to attach objects to certain objects in 3D.

Object Tracking gives you the screen space bounding box of the object found in the camera. By default, object tracking supports the attachment of 2D images or animations to this bounding box. That said, you are able to attach 3D objects to Object Tracking. Because object tracking is in 2D screen space, we need to add a script to attach the 3D object at a tuned depth in the scene to the Object Tracking object.

First, download the AttachToObjectTracking.js script below:

Download AttachToObjectTracking.js

First unzip and then drag and drop the AttachToObjectTracking.js script into the Asset Browser panel. Next, create an new empty object in the Scene Hierarchy panel. Select the empty object and in the Inspector panel, select + Add Component and choose the newly added AttachToObjectTracking.js script resource.

Then set the AttachToObjectTracking settings as follows:

  • Perspective Camera: Set this to the perspective camera in your scene (not the orthographic)
  • Object Tracking: Set this to the Object Tracking object you want to attach your content to
  • Object to Attach: Set this to the 3D Object you'd like to attach to your Object Tracking object
  • Base Depth Factor: Tune the starting depth for the attached object. The depth is then scaled based on the size of the Object Tracking bounding box
  • Apply Rotation: If the rotation of the Object Tracking object should be applied to the Object to Attach
Was this page helpful?
Yes
No

AI-Powered Search