Reading Time: 5 minutes
Checked with: Unity 2018.3.10f1
The Simulated CameraRig prefab provides a simulated setup that requires no XR hardware to develop and build with. It creates a pseudo headset and controllers that can be manipulated via the mouse and keyboard, which helps testing and building virtual environments without the need for actual hardware to be plugged in.
The outcome of this guide is to learn how to add the Simulated CameraRig prefab to the scene and configure it along with a TrackedAlias prefab.
HMD- A Head Mounted Display is a display device that is worn on the head, usually a VR/AR Headset.
CameraRig- A GameObject that contains a HMD representation and controller representations.
Facade- A facade provides a user friendly interface into a more complex underlying system.
Expand the VRTK Prefabs Package directory in the Unity Project window until the
Prefabs -> VRTK Prefabs -> CameraRig -> SimulatedCameraRig directory is visible and select the
SimulatedCameraRig directory so the contents are displayed.
SimulatedCameraRig prefab then drag and drop it into the Unity Hierarchy window.
TrackedAlias GameObject in the Unity Hierarchy window then increase the
Camera Rigs -> Elements -> Size property by
1 on the
Tracked Alias Facade component
Note: In this example we’ll be setting it to
2as there is already a
UnityXRCameraRigin the scene.
Drag and drop the
SimulatedCameraRig GameObject from the Unity Hierarchy window into the newly displayed
Element 1 field within the
Elements parameter on the
Tracked Alias Facade component.
Now you have a UnityXR CameraRig in the scene along with a Simulated CameraRig. Only one CameraRig should be enabled in the scene at any one time, so for now disable the
SimulatedCameraRig GameObject and play the Unity scene.
The scene will start using the UnityXR CameraRig and display via the connected XR hardware, however if you disable the
UnityXRCameraRig GameObject in the Unity Hierarchy window and then enable the
SimulatedCameraRig GameObject in the Unity Hierarchy window then the active scene CameraRig will switch to being the Simulated CameraRig.
TrackedAlias prefab will automatically update to use the newly activated CameraRig and allow you to continue playing the scene in the simulated mode.