Unity Development HTC Vive V, Pickup and touch

Source: Internet
Author: User
Tags touch

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");
	}
}


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.