Configuring the VRSimulator > Managing Your Camera |
One of the challenges in developing for VR is the fact that you have limited control over your user's environment. Maybe you're expecting them to be sitting down, but in reality they'll be standing. Maybe you'll expect them to be standing, and in reality they'll be seated on the floor. Maybe their room-scale play space is 20x20, or maybe it's 5x5. That adds a level of complexity to the development and testing experience that is...well, a pain.
The VRSimulator helps make testing for different situations a little easier. Key to that process is effectively managing your VR scene's camera. The VRSimulator uses your VR Camera Rig as a proxy for the user's head/eyes. That's exactly what the VR HMD does when it's connected to your computer: It tracks where the HMD is, and adjusts the position and rotation of the Camera Rig based on its tracked position.
Using the VRSimulator and the HMDSimulator Configuration Settings, you can:
Be Aware | |
Always remember that the VRSimulator is using your virtual reality camera rigs to display VR content on your regular (non-HMD) monitor. By design, both the SteamVR plugin and Oculus Utilties for Unity optimize rendering for a stereoscopic display in an HMD. The compositors they use to render monoscopically in Unity Play Mode create varying degrees of visual distortion, creating a sort of fish-eye lens effect. This will make objects in your VR scene look strange - sometimes very close, sometimes far away - when you view them on your screen. If you put your HMD on and take it off to look at your on-screen view, the distortions are pretty apparent. This is particularly apparent when you look at the simulated controllers generated by the VRSimulator. By design, the VRSimulator does nothing to compensate for this distortion - it just uses the VR camera rigs as they are, and positions its simulated controllers in worldspace so that they would "look right" rendered in your VR HMD. This is an intentional design choice, meant to maintain positional, rotational, and scaling consistency between your simulated VR environment and your actual VR environment. If we were to position the simulated controllers so that they seemed undistorted on a regular monitor, then they would not interact with the rest of your VR scene the way your player's actual VR controllers would. Sorry about the distortion - but the consistency in design and positioning for your actual VR experience is really worth it. |
Before you can use the VRSimulator, you need to set up your camera rig. The VRSimulator supports two camera rig prefabs:
Be Aware | |
If you have customized either of the prefabs - in particular, if you have changed their name - the VRSimulator will not auto-detect the camera rig. You have to explicitly selct it in the VRSimulator's Unity Inspector settings. |
You Should Know... | |
The Oculus:OVRCameraRig prefab can either be inserted directly from Assets / OVR / Prefabs /, or you can also insert the Oculus:OVRPlayerController prefab. You can set the HMDSimulator's Camera Rig setting equal to either Oculus:OVRCameraRig directly, or to its OVRPlayerController parent, depending on your preferences. |
Your VR scene needs to contain one or more of these prefabs. It also cannot contain the default Unity Main Camera gameobject.
Be Careful! | |
If your scene does not contain SteamVR:[CameraRig], but does contain multiple instances of Oculus camera rigs (for example, one Oculus:OVRPlayerController and a sibling Oculus:OVRCameraRig or multiple OVRCameraRig objects), then you're going to get strange behavior (both in the VRSimulator, and in your Oculus HMD itself). You should only ever have one instance of OVRCameraRig enabled in any VR scene. |
If you are using a customized camera rig, or if you have changed the name of the camera rig gameobject, the VR Simulator will be unable to auto-detect it. In this case:
If the VRSimulator detects a connected HMD, then it will not simulate an HMD (because it assumes you'll be using your headset).
However, detecting a connected headset does not happen instantly. Both the SteamVR plugin and the Oculus Utilities for Unity take a little time to discover a connected headset. The amount of time varies widely, we suspect based on motherboard, graphics card, system resources, etc. That's why the VRSimulator automatically waits a set time to discover a headset before activaitng your simulations. You can configure the amount of time to wait in the HMDSimulator's HMD Discovery Time setting.
You Should Know... | |
So long as the VRSimulator is in your scene, it will still capture and apply your Input & Movement controls. So you can still explore your scene with your headset connected but not on your head - the inputs will all work just the same. You might just have a bit of a funny view, depending on where your headset is. |
When actually using a headset, your camera's height is automatically calculated by your VR platform's sensors and your user profile. Obviously, that won't work if there's no HMD connected. Therefore, the VRSimulator lets you set the height that you wish to simulate using the HMDSimulator's Height setting.
You can set your user's initial height to one of three options:
Be Aware | |
The Height setting only sets your camera's initial height. What you do with your simulated camera's height later on is entirely up to you. |