A starter project for unity tutorials
Unity 2018.2.12f1 (You can use Unity Hub to manage versions on your computer) -- Go to page of Unity Hub.
SteamVR 2.1
- open up an empty new project, create a new scene as playground
- delete Main Camera from the scene, as we will be using VR camera instead.
- go to the asset tab, search steamVR plugin, download and install. A folder named "steamVR" will show up
- on the menu, go to Window - SteamVR Input
- a window shows up and we see different action sets, you can create your own action set and modify it, but usually we just use "default" set directly
- click save and generate. wait for steamVR to generate code for interaction scripts.
- on the menu, go to Window - SteamVR Input
- in the actions section, click the little "+" icon, you will be able to add a new action for controller.
- give it a name as "TouchPad", type as "boolean", localized string as "touchpad"
- click the little "+" icon again, create another action named "TouchPos", type as "vector2", localized string as "touchpos"
- click save and generate.
- on the menu, go to Window - SteamVR Input
- make sure your steam app is running, click "Open binding UI"
- a webpage will pop up, at the card of "vive_controller", click edit
- on left side, scroll down to "Trackpad" section, there is "TRACKPAD" card, and you see "click", "touch", "position" three actions
- set Click to be "teleport", Touch to be "touchpad", Position to be "touchpos"
- save the bindings and click "Go back" on the top. Quit.
- in the Assets folder, go to Steam folder, open "simple sample" scene
- if you have HTC vive connected, you can run the scene.
- on the menu, go to Window - steamVR input live view
- you will see if you touch / have contact(not press) on the touchpad, the value will change from false to true
- same as the touchpos, a 2D vector value will change based on your touch area
- in the Assets folder, go to SteamVR - InteractionSystem - Samples, open InteractionExample scene
- in the scene, you will see a bunch of objects available as examples for interaction
- Player object is the core object we want, as it contains steamVR camera object and controller objects that are necessary for VR interaction
- you should learn how different script objects are placed and structured in the Player object, how they reference each other
- The demoVR scene in the project provides a simplified working version of the Player object, named as "VR Player", you can start from that object and see if you can understand how it works.