Modified March 24, 2017
The Vive SDK SteamVR is upgraded with some changes. The latest SteamVR1.2.1 in the Unity5.4.4 under a mad error.
The following content is done in the following environment
unity5.4.4
SteamVR1.2.0 (http://download.csdn.net/detail/wuyt2008/9792970)
Viveinpututility1.5.1beta (http://download.csdn.net/detail/wuyt2008/9792980)
1. Import SDK:STEAMVR plugin and Vive Input Utility
2. Drag Camerrag into the scene
Drag vivecolliders into the scene
3. Add Pickup Object
Add a 3d object and add the script Basicgrabbables, then the object can be picked up.
The object is to be picked up before it is written, and a rigid body component needs to be added
4. Add Touch objects
Add a 3d object that can be touched by default
5. Add Contact Effect
Add a script Materialchanger on a 3d object, set its parameters
Normal: Default Map
Heightlight: Texture after touch
Pressed: Map When the button is pressed
Heighlight button: Specifies the default is trigger
6. Operation
When you touch the Pickup object, the green is displayed,
After pressing the button, turn red to move the rotating object.
Touch the object can touch, press the button to turn red, but cannot move and rotate
7. Event response
VIVE supports the following events
Icollidereventhoverenterhandler Icollidereventhoverexithandler Icollidereventpressdownhandler Icollidereventpressuphandler Icollidereventpressenterhandler Icollidereventpressexithandler Icollidereventclickhandler Icollidereventdragstarthandler Icollidereventdragupdatehandler Icollidereventdragendhandler Icollidereventdrophandler Icollidereventaxischangedhandler Use method, create a new script as follows, and add the script to the game object, Can.
Using System.Collections;
Using System.Collections.Generic;
Using Unityengine;
Using HTC. unityplugin.colliderevent;
public class Vivelearn:monobehaviour,icollidereventhoverenterhandler {public
void Oncollidereventhoverenter ( Colliderhovereventdata eventData) {
Debug.Log ("hover");
}
}