VRTK.Documentation

Educational guides and tutorials for learning VRTK

> Home > How-to Guides > CameraRigs

Adding A TrackedAlias

  • Level: Beginner

  • Reading Time: 2 minutes

  • Checked with: Unity 2018.3.10f1

Introduction

The TrackedAlias prefab provides a way of attaching elements to Camera Rig configurations without specifically tying them to the underlying SDK Camera Rig.

This is useful if you want to support multiple SDK Camera Rigs in your scene but don’t want to duplicate the same child GameObjects of all the relevant SDK Camera Rigs.

Useful definitions

Prerequisites

Let’s Start

Step 1

Expand the VRTK directory in the Unity Project window until the VRTK -> Prefabs -> CameraRig -> TrackedAlias directory is visible then drag and drop the TrackedAlias prefab into the Hierarchy window.

Drag TrackedAlias To Hierarchy

Step 2

Select the TrackedAlias GameObject in the Unity Hierarchy window then change the Linked Alias Association Collection Observable List component and increase the Elements size property by 1 (it will be 0 by default so change it to 1)

Tracked Alias Facade Camera Rigs Size

Step 3

Drag and drop the UnityXRCameraRig GameObject from the Unity Hierarchy window into the newly displayed Element 0 field within the Elements parameter on the Linked Alias Association Collection Observable List component attached to the TrackedAlias GameObject.

Drag And Drop UnityXRCameraRig Into TrackedAlias CameraRigs

Done

Now you have a TrackedAlias in your scene that will track the first active valid Camera Rig that is set in the Camera Rigs list. At the moment there is only one Camera Rig set so it will only be tracking the UnityXRCameraRig.

You can now place other GameObjects in the TrackedAlias child GameObjects and they will follow the active SDK Camera Rig without being specifically tied to it.

TrackedAlias In Scene With Example Avatar Objects