September 16, 2018
As I’m developing a VR game in Unity for the Progressive Game Jam at Square One Clubs, I want to share some of the things I’m learning along the way. For now, I’ll be focusing on Oculus Rift support. But I plan to add support and info for other headsets later.
If you want to follow along, you’ll need Oculus Rift + Touch and a computer that meets the Rift system requirements. I’m using Unity 2018.2.8f1.
If you haven’t yet added VR support, follow Part 1 to do so now.
In Part 1 we were able to see our scene in VR. But if you tried looking at your hands, they were invisible. Let’s add support for our nifty Touch controllers so we can see our hands and navigate around the scene. To do so, we will need to add additional Oculus assets to the project.
The easiest way to add Oculus controller support to a Unity project is to install Oculus Integration from the Unity Asset Store. It just got updated to v1.29. However, sometimes it lags behind the official Oculus SDKs.
Ctrl+9or Window > General > Asset Store
download (or update) Oculus Integration if necessary
But, if the Oculus Integration package isn’t up to date and you want the latest version, the Oculus SDKs can be downloaded directly from Oculus Developer Downloads and imported into Unity. There are three main packages for our purposes:
Now that we’ve added additional Oculus support, let’s add Oculus’ player controller to the scene. This will replace Unity’s camera and will enable basic navigation.
In the Project pane, expand Assets > Oculus > VR > Prefabs
Now, we can add an avatar for our player. We will use Oculus’ LocalAvatar prefab to see only our hands. The RemoteAvatar prefab is intended for seeing other visitors’ avatars.
In the Project pane, expand Assets > Oculus > Avatar > Content > Prefabs
Add a ground plane to prevent the player from falling and use a cube for reference
also, we’ll keep the cube from part 1 as a reference and set its position to: (0, 0.5, 3)
We have now added basic Oculus Touch controller support to our scene including navigation and tracked hands.
Stay tuned, next time we will add the ability to grab an object with our hands.
Written by Mike Henry, VR enthusiast and software developer. Follow Mike on Twitter