How to create and run a macOS VR app using Unity: Part 2

If you’ve been eying the latest trends in game development you couldn’t possibly miss the recent hype (deserved in my opinion) around VR and AR applications. We’ve also spoken at length about installing and running an HTC Vive VR headset on your Mac running macOS High Sierra.

With an eGPU development kit offered by Apple or with the newest iMac Pro running a powerful AMD Radeon Vega GPU, you can create and then run VR applications directly on a connected HTC Vive VR headset. Here’s part2 on how to create and run a simple VR application on macOS and HTC Vive! Take a look at part 1 to get you up to speed!

This tutorial was written following the video tutorial provided by VRGameDev so be certain to check out their channel!

How to make your hands

To keep things simple, the “hands” in our application will be two simple spheres but will be able to use the trigger buttons on the HTC Vive controller to grab the cube.

  1. Under Hierarchy again, select Create > 3D object > Sphere.
  2. Select Sphere.
  3. Under Transform, change the scale to X=0.1, Y=0.1, and Z=0.1.
  4. Leave the position at X=0, Y=0, and Z=0.
  5. Select Sphere under Hierarchy and rename it to LeftHand.
  6. Option-Click LeftHand and and select Duplicate.
  7. Rename the duplicate to **RightHand.
  8. Select both LeftHand and RightHand.

  9. Under Sphere Collider click the gear and Remove Component (we don’t want our hands to collide with each other in VR).

How to copy some C# code

Since learning C# or other programming languages is beyond the scope of this article, we can import code to tell our application what to do with the input controllers of the HTC Vive. You can copy the code here into a simple text editor (I use vi), save it as HandGabbing.cs, and finally to merge it into your VR application.

Leave a Reply