HTC Vive

From ETC Public Wiki
Jump to: navigation, search

HTC Vive is a virtual reality headset that uses "roomscale" tracking that allows the player to move in 3D space. It uses motion-tracked handheld controllers to interact with the environment. As a part of the BVW course, students will be using HTC VIVE Tracker VR Object Tracker and Vive Controllers.

Getting Started

Basic setup

  1. Open Unity Project
  2. Go to Edit -> Project Settings -> Player
  3. Click on XR Settings in the Inspector
  4. Check Virtual Reality Supported
  5. Remove Oculus if it exists in the list under Virtual Reality SDKs (This can be done by selecting Oculus and hitting the minus sign at the bottom right)
  6. Make sure OpenVR has been added under Virtual Reality SDKs (If you don't see it, hit the plus sign at the bottom right and select it from the list)
  7. Download Steam VR plugin from asset store
  8. Import it into your project, and click on "I Made A Backup", and click on "Accept All"

Scene Setup

  1. After import is complete, delete "MainCamera" from the hierarchy
  2. From your project window, select Assets -> SteamVR -> Prefabs
  3. Drag [CameraRig] and [SteamVR] into your hierarchy
  4. Now you can get tracking information from controllers!

Using Vive Controllers

See the commented code snippet below

// get a reference to the Vive controller
SteamVR_Controller.Device myController = SteamVR_Controller.Input(index);

// then you can get inputs from the controller by calling methods on it
bool isHairTriggerDown = myController.GetHairTriggerDown();
bool isHairTriggerUp = myController.GetHairTriggerUp();

// you are encouraged to look into the "Device" script to see what kind of functionalities it provides
// so you might find things like this
bool isGripDown = myController.GetPressDown(EVRButtonId.k_EButton_Grip);
Vector2 touchPad = myController.GetAxis(EVRButtonId.k_EButton_SteamVR_Touchpad);

Tracker setup in Unity

  1. Import TrackedObject Script from here (This script only works for two trackers which is the requirement for Round 1/2)
  2. Create an empty GameObject (or, to be able to see it in the game, you can create a sphere)
  3. Add "TrackedObject" component to it, and set the component's TrackedDevice to "Tracker1" or "Tracker2"
  4. Each device correspond to a tracker but the mapping of tracked GameObject to physical trackers may not remain the same

In play mode, tracking information will be send to the "SteamVR_TrackedObject" component, and will be used to modify the position and rotation of that GameObject

Notes and tips:

  1. Rendering the tracker: Create a child GameObject under the tracked GameObject, add "SteamVR_RenderModel" component. In that component, set "ModelOverride" to "{htc}vr_tracker_vive_1_0"
  2. To get the best tracking quality, make sure the tracker is always visible to at least one base station
  3. If you see poor render quality, make sure you are not in Steam Menu in the headset. If you are in the menu, press the menu button on the vive controller to exit
  4. If the LED is not green on the tracker, press and hold the button for a few seconds until it turns blue and then green
  5. If the LED is blinking, it means it is pairing with the headset or the dongle

Tutorial Links:

  1. Unity VR Overview
  2. HTC Vive Tutorial
  3. Input for OpenVR Controllers

Programming Information

Here we'll list all of the quirks and nasty bits to know about programming on this platform, and we might even include some useful scripts or links in this section.

Testing Vive Worlds

  1. When you are in the bullpen, the easiest way to test your Vive world is using an FPS controller instead of the Camera Rig.
  2. However, make sure that you leave enough time to test in the platform room with actual Vive.

Art (2D & 3D) Information

Art definitely changes from platform to platform, so tips and rules on how to make art for this platform are a must. Maybe it's a particularly weak platform (e.g. HoloLens) so minimizing polys is important, or there's a special quirk to the utility of the platform (e.g. an AR platform using black as its transparency). Listing some samples would be good for the students, too.

Sound Information

Many platforms have their own special influence on the sound of the projects made on them. This is especially so when the platform has its own sound hardware, whether that's speakers or microphones. It may even be good to include some sample sounds that would work well or ones that would be good to avoid here!

Design Guidelines & Tips

  • Make sure the props you use do not block the trackers, it will lose tracking
  • It is not a good idea to have players hold the tracker directly in their hand, try using props/gloves and attach the tracker to it
  • Try to use the roomspace (marked by white tape on the floor)
  • If you're disabling the controller models and using your own models (hands, sword etc.), make sure they are placed at a good distance from your body so that it feels natural to the player.
  • Try using spatial sound in VR to take advantage of the roomspace

Example Projects

List some (downloadable!) example projects here--and make sure you include the software versions! That way, the students don't have to just take your word for it, they can also check what we've written in this wiki against an actual sample.

Previous ETC Projects

List relevant previous ETC projects here. Obviously for things like Unity, we should only list projects directly related to Unity, but for things like Lumberyard, we could probably list every project that has used it.

BVW

This section is dedicated to information that's purely used in BVW: online resources that the TAs recommend, FAQs from Piazza, and topics that pop up during the semester that we don't want to keep repeating ourselves about.