Unity with Vive VR with Primitives


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.
Select 3D.
Select Create Project.

Close the Services tab, right mouse over the tab, select Close Tab.

Add some primitives
The nice thing about primitives is the dynamic collisions are already set up.
Choose GameObject->3D Object->Plane  etc

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

Type Steam VR Plugin  the free one
Select the
Steam VR Plugin and Download

Choose Import
Choose Accept All and OK a few times

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

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

Drag the CameraRig into the Hierarchy tab

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

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

In the Inspector tab: select Add Component -> Physics-> Box Collider
     Input Center:    X: 0   Y: -0.04   Z: .02
     Input Size:   X: 0.14   Y: 0.07   Z: 0.05

Main Camera Settings
Select the Main Camera from the Hierarchy tab
In the Inspector tab
Target Display to Display 2.

     Change the Target Eye to None

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

Add Physics Material to make the objects bouncy
Select the Create Menu under the Project tab  (or  Assets->Create from the menu)
Select Create->Physic Material, give it a name


Double click the Physic Material and change Dynamic and Static Friction to 0

Select the object you would like to bounce
     In the Inspector tab, under Object Name Collider, change the collider material to the Physic Material you just made.


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

Hit the Play button   unity_play_arrow

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 everything is connected
Make sure the hand held controllers have charged batteries
Use the Steam VR utility to recalibrate the size of the active area if necessary

Testing without the Vive
Hit the Play button   unity_play_arrow
Change to Display 2 in the Game window.

If the camera view does not look right, Make sure Scale is 1x in the Game window.