This is the code repository for Unity Virtual Reality Projects - Second Edition, published by Packt. It contains all the supporting project files necessary to work through the book from start to finish.
This book takes a practical, project-based approach to teach you the specifics of virtual reality development using the Unity 3D game engine. We walk through a series of hands-on projects, step-by-step tutorials, and in-depth discussions using Unity 2018 and other free or open source software. While VR technology is rapidly advancing, we'll try to capture the basic principles and techniques you can use to make your own VR games and applications immersive and comfortable.
You will learn how to use Unity to develop VR applications that can be experienced with devices such as the Oculus Rift, Google Daydream, HTC VIVE, and others. We'll cover technical considerations that are especially important and possibly unique to VR. By the end of this book, you will be equipped to develop rich and interactive virtual reality experiences.
All of the code is organized into folders. Each folder starts with a number followed by the application name. For example, Chapter02.
The code will look like the following:
void Update () {
Transform camera = Camera.main.transform;
Ray ray;
RaycastHit hit;
GameObject hitObject;
Before we get started, there are a few things that you'll need. Grab a snack, a bottle of water, or a cup of coffee. Besides that, you'll need a PC (Windows or Mac) with Unity 2018 installed.
You don't need a super powerful computer rig. While Unity can be a beast that can render complex scenes, and VR manufacturers like Oculus have published recommended specifications for PC hardware, you can actually get by with less; even a laptop will do for the projects in this book.
To get Unity, go to https://store.unity.com, select Personal, and download the installer. The free Personal version is fine.
We also optionally use the Blender open source project for 3D modeling. This book isn't about Blender, but we'll use it if you want. To get Blender, go to https://www.blender.org/download/ and follow the instructions for your platform.
Access to a virtual reality head-mounted display (HMD) is strongly recommended in order to try out your builds and get first-hand experience of the projects developed in this book. Although not entirely required, you can use the emulation modes while working in Unity. Depending on your platform, you may need to install additional development tools. Chapter 3, VR Build and Run, goes into details of what you need for each device and platform, including SteamVr, Oculus Rift, Windows MR, GearVR, Oculus Go, Google Daydream, and others.
That should just about do it—a PC, the Unity software, a VR device, other tools described in Chapter 3, VR Build and Run, and we're good to go! Oh, some projects will be more complete if you download the associated assets from the Packt website, as follows.