0a  Unity primitives with Vive VR

smallarrows.GIF

Basic VR with Unity primitives and HTC Vive

Start Unity (You may need to set up an account)
Select NEW
    
Give your project a name such as  Primitive_Tutorial. This will create a folder with folders inside.
     Save to the Desktop or your external drive.
     Select 3D
.
     Select Create Project.

(If there is a Services tab, right mouse over the tab, select Close Tab.)

Make sure the main view is the
Scene tab.



Add some primitives
The nice thing about primitives is the collision boundaries are already set up.

Choose GameObject->3D Object->Cube etc. Use a Cube for the floor, scale it down in the Y axis.

unity_toolbar
Hand moves view, Move Tool, Rotate Tool, Scale Tool ,Rectangle Select, Move rotate scale tool.

Check the Inspector tab on the right, Scale should be around 15, .1, 15 x,y,z for the floor cube.
Set Position to 0, -.05, 0
You can re-name the floor in the Inspector tab.

Add more primitive shapes, place them above the floor.



Scene View
Use the Alt key to move the camera around in the scene.

Click an axis such as X in with the XYZ axis to look down the X axis.
You can toggle between
Persp, Iso and 2D by clicking on the word below the axis.
unity_persp_axis




Import a Steam VR Camera and Controllers for Vive
Choose Window->Asset Store

Type SteamVR in the search bar
unity_VR_steam_plugin
Select the
SteamVR Plugin by Valve  (It is free)
Choose Import twice (Ignore errors, select I made a backup go ahead)


Put the main view window back to Scene instead of Asset Store
Click the Scene tab on the left


Select the SteamVR folder from the Project tab
Select the arrow, select Prefabs
Select the CameraRig
In the Inspector tab
change Size to Calibrated, this uses the calibrated area from the headset


Drag the CameraRig into the Hierarchy tab

Unity_steam_primitives1



Add RigidBodies and colliders to Vive hand held controllers
Open the arrow for CameraRig
in the Hierarchy tab choose both the Controllers

In the Inspector tab
: select Add Component->Physics- RigidBody
     Turn off  Use Gravity

Add some colliders to your Controllers so they can push things:
In the Inspector tab
: select Add Component->Physics->Box Collider
     Input Center:    X: 0   Y: -0.04   Z: .02
     Input Size:   X: 0.12   Y: 0.07   Z: 0.05



Add Physics to the primitives
Select all the primitives in the Hierarchy, except the floor, note primitives already have colliders
In the Inspector tab: select Add Component->Physics->RigidBody
Do this for every shape that can move



Setup the Main Camera to be used later
Select the Main Camera from the Hierarchy tab
     Change Target Display to Display 2

     Change Target Eye to None in the Inspector tab
(The main camera interferes with the Vive camera if you do not do this.)



Try your Project with Vive
Start the Steam program from Desktop:
Select the VR button

Hit the Play button   unity_play_arrow

Answer
Accept All in the Steam VR plugin
popup window

Turn on the hand held controllers, put on the headset



If the Vive VR is not working:
Make sure the headset and controllers are connected
Try wiggling the Headset and pressing the buttons on the controllers
Make sure the hand held controllers have charged batteries
Make sure SteamVR status utility is running
     Start Steam  unity_steam_logo
     Login
     Hit this logo in the upper right of the steam window, you can close the large window  start_steam_VR
     Ignore Display and Base Station warnings, it will work.
    
unity_steam_status
Steam Status Utility will look like this if it is ready.

Reset Steam if you don't see all the icons
     Select the down arrow next to SteamVR unity_steam_arrow
     Select Devices->Reboot Vive headset
     There is also a menu to Run Room Setup, this should be done already


Testing without the Vive
Hit the Play button   unity_play_arrow
Change to Display 2 in the Game window.  (The Vive is using Display 1)

If the camera view does not look right, Make sure Scale is 1x in the Game window.
You can position this camera using the Scene view when the Game is not running.



Add a Physics Material to make the objects bouncy
Select the Assets->Create->Physic Material from the menu.
Give the material a name.


Select the Physic Material
change Bounciness to .8

Select the object you would like to adjust the bounciness:
     In the Inspector tab, under Collider, assign the Material to the Physic Material you just made.

unity_phy_material2



Change the Skybox
Choose
Window->Asset Store

     Type skybox in the search bar
    
select
FREE ONLY
     select Download and Import
Put the main view window back to Scene


Choose Window->Lighting->Settings
     Change the Skybox Material to the skybox you imported, you can make your own.
     Change Resolution to 512 or more (default 128)
     Vive resolution is 1080x1200 per eye



Change the color of the light
     Select the Light in the Hierarchy tab
     Change the Color in the Inspector tab


...

Fix the shadows on your light
Edit->Project Settings->Quality
     In the Inspector tab
          Change Shadow Resolution to Very High Resolution
          If the light is a point light, change Shadow Distance to a lower value like 50, default 150



Build your project to run on it's own
Select File Build Settings
     Select PC, Mac & Linux stand-alone
     Select Build & Run
          Select your Target Platform

          Create a folder
          Save to the folder
3 items you need to play will be in the folder: 1 build_data folder, 1 .dll file, 1 file to play your scene

When you run your project select Graphics quality Ultra

OBS
OBS screen capture VR documentation