Acquiring the Oculus SDK package

Unity provides built-in support for most of the virtual reality devices on the market. Additionally, Oculus provides a set of utilities which contains a variety of assets (scripts, prefabs, demonstration scenes, and so on) to facilitate development for the Rift and Samsung Gear VR. Installation of the utilities can be done by importing the Oculus Integration plugin from the Asset Store or by downloading the Oculus Utilities for Unity from https://developer.oculus.com/downloads/unity/.

At the time of this writing, the current version of Unity is 2017.2 and the OVRPlugin (included in the Utilities) is 1.18.1. However, as the company is constantly improving the platform, major revisions are always on the horizon. Take the following steps to integrate it:

  1. Search for the Oculus Integration plugin in the Asset Store
  2. Select the package and click the Import button

The Import Unity Package window (see the following screenshot) will display each of the Oculus Utilities assets included in the package.

  1. Scroll down about halfway and uncheck Scenes. These will not be needed for our project. Click the Import button at the bottom of the window to continue:
Figure 3.4: Import everything except the Scenes directory
Adding this package will probably require an update of various Oculus scripts. Choose Go ahead in the API Update Required dialog to update any obsolete scripts.
If a dialog opens asking to Update Oculus Utilities Plugin, choose Yes and restart Unity if asked to do so.

When the import is completed, many new files and directories will be added to the Project window. It is important that these files and folders remain where they are. Moving them will result in errors as the location of scripts will be unresolved by the software. Now, take the following steps:

  1. Delete the Main Camera GameObject.
  2. Browse the Project panel to find the OVR/Prefabs directory. Locate the OVRCameraRig prefab and drag it into the Scene window.

The OVRPlugin package includes many GameObjects, scripts, and prefabs. These items have been developed to provide content creators with the tools necessary to build new VR experiences. The OVRCameraRig contains multiple cameras and targets to control the VR experience. This camera will serve as the user's viewing portal in our VR environment.

The Game window will reveal the scene image as soon as the prefab is added:

  1. Set the position of the OVRCameraRig to (0,0,-1.5) in the Inspector window
  2. Save the Unity scene
  3. Use File | Save Scene to create WIP_2
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.188.108.54