Virtual Reality (VR) is a fantastic technology that immerses users in a computer-generated environment. To prepare your scene for VR, you need to set up the camera position and environment to ensure that the user has a comfortable and immersive experience. In this guide, we will walk you through the steps to prepare your scene for VR.
Please follow the instruction in the correct order:
Positioning the VR Main Location
Open your scene and create a startup position for the VR headset. This position should be in front of the model you want to see, at an average distance from it, and at the same height as your eyes (usually between 1.4-1.5 meters).
Duplicate the "Main location" under UI Data, rename it "VR Main location," and drag it to the "Devices" game object in the hierarchy and in the inspector to Main location - VR position.
Then position it as explained above.
Note: Camera rotation transform needs to be on the X and Z in 0 positions. only the Y needs to be affected as we want the camera to face the model.
Setting up the VR Floor
In the scene, you can find the "Environment" game object under RootMain.
Turn on the floor to make it visible when you enter VR mode.
Duplicate the Floor game object, rename it "VR Floor," and enable Mesh renderer and Mesh collider in the inspector.
Drag the VR Floor under the Floor in the hierarchy.
Remove the tick from Mesh Renderer in the Floor game object and add a new component by clicking on Add Component.
Search for Teleport Target (Script) and add it.
In UIData, find "ON VR Activate/Deactivate" in the XR Events and drag the VR Floor there.
Set the ON as a Game.Object.SetActive and make it by default On by clicking on the little box.
Note: If your model is not zeroed in the middle of the scene (X, Y, Z on 0) please move manually the floor to the bottom of the model, then you need to set up the camera and the floor.
Testing the VR Mode
Build a PC build to test your VR mode.
Connect your headset while the app is open.
Test the scene to ensure that the camera and environment are set up correctly.
Note: The VR setup is a back-and-forth process, as we want to achieve the best result regarding the eye's height, So it's okay to try a couple of times till you get the best result.
In conclusion, preparing your scene for VR is easy and requires setting up the camera position and environment. Following these simple steps, you can prepare your scene for VR and test it to ensure everything is set up correctly. With VR, you can create immersive experiences that transport your users to another world, and by setting up your scene correctly, you can make sure that they have the best experience possible.