HTC Vive Unity Tutorial

Last Updated: January 30 2021

HTC ViveUnity

Welcome to our Unity VR tutorial for Steam VR (a gaming software platform developed by Valve Software) and the HTC Vive head-mounted display (HMD)! Even though this tutorial is written for HTC Vive (2018), the setup guide applies to later Vive virtual reality headsets such us HTC Vive Pro and Vive Cosmos models.

In this set of VR tutorials, we're going to cover setting up HTC Vive for VR development, using the HTC Vive controller, interacting with objects in VR and several other topics used for creating an HTC Vive Unity application. Each tutorial is focused on VR development fundamentals to help you learn how to make virtual reality games and applications of your own!

Before we get into the nitty gritty, let's make sure that we have the pre-requirements met. To install your HTC Vive device for development, you should meet minimum hardware requirements. Your CPU (core processor speed) and GPU (graphics card) are the most important aspects for solid VR experiences.

You can always click your way to SteamVR and check VR Performance Test to see whether your PC is up to snuff. The latest gaming laptops might also be good enough to support your gaming and development on the Vive.

This guide doesn't delve into setting up HTC for gaming. That should be rather simple:

  • establish the play area
  • setup base stations around that area
  • make sure the cables are behind you
  • Plug in and connect the link box to your computer
  • Use high quality audio headset for better immersive virtual reality experience

Before you prepare your Vive device for development, you should set it up correctly, run Room Setup and test it out by launching it in SteamVR.

HTC Vive Hardware

Screen: Dual AMOLED 3.6’’ diagonal
Resolution: 1
080 x 1200 pixels per eye (2160 x 1200 pixels combined)
Refresh rate:
90 Hz
Field of view:
110 degrees
Safety features:
Chaperone play area boundaries and front-facing camera
Sensors:
SteamVR Tracking, G-sensor, gyroscope, proximity
Connections:
HDMI, USB 2.0, stereo 3.5 mm headphone jack, Power, Bluetooth
Input:
Integrated microphone
Eye Relief:
Interpupillary distance and lens distance adjustment

Controller specs
Sensors: SteamVR Tracking
Input:
Multifunction trackpad, Grip buttons, dual-stage trigger, System button, Menu button
Use per charge: Approx. 6 hours
Connections:
Micro-USB charging port

Tracked area requirements
Standing / seated: No min. space requirements
Room-scale:
Up to 15m 2 *
*An area of approximately 3.5m x 3.5m

How do Launch the "Run Room Setup"

To launch a Room Setup head to Steam VR menu and click the Room Setup button. A short tutorial will launch and show you how to use the system. Adjust the headset fit by loosening or tightening the straps and make sure the cables are out of your way and the headphones aren't too snug. You'll also want to check the Interpupillary Distance (IPD) using the knob on the side to your preference. Wrongly set IPD may interfere with full field of view. Make sure the lenses are set up to your pupils. The lens should be directly above your eye.

For troubleshooting revert to HTC's support but in most cases the issues are trivial: check the power outlet, make sure you have the latest firmware update and usb cable or hdmi cable are connected.

Here's HTC's official video tutorial for Setting up VIVE for Room-scale experience.

https://www.youtube.com/watch?v=rv6nVPPDmEI

We've divided it into 7 sections:

1. Introduction and Vive Setup

In this section we’ll cover what you need for getting started and setting up Unity, SteamVR, and the HTC Vive headset.

2. Picking Up, Moving and Throwing Virtual Objects

In this section we'll cover creating a basic interaction script that will teach you how to pick up, move and throw objects with your HTC Vive controllers.

3. HTC Vive Controller Interactions

In this section we'll upgrade the basic interaction scripts from the previous section to create new types of interactions like pressing a button and triggering an action.

4. Create a VR Button, Lever and Gun!

In this section we'll cover some examples of how to use the classes we've created to implement some basic interactable objects: a button, some levers, and a gun.

5. Input from the HTC Vive VR Headset and Controllers

In this section we'll cover using Raycasting to interact with objects by "pointing" with your head and hands, rather than "grabbing" them.

6. Raycasting Examples

In this section we'll cover some examples using our new raycast interaction scripts from the previous section.

7. Some Useful Tools

In this section we'll cover Steam VR tools and other useful HTC Vive VR development resources that will help you make virtual reality applications.

For this tutorial we were using Unity 5.5.1f1 and Steam VR plugin for Unity - v1.1.1. Visit the GitHub page to download the project if you'd like it to follow along with. You can make your way through the tutorial without it, but it will make it easier for following along. Get started with Section One: Introduction and Setup!

We offer live classes to help you learn virtual reality programming and development in Unity. For professional virtual reality training visit the courses page.

AUTHOR

AMANDA END

Instructor & Unity Developer

Receive our newsletter to stay on top of the latest virtual reality and augmented reality info.