Implementing custom controls with Unity Vive Wave SDK

Highlighted
Chefty
New Arrival

Implementing custom controls with Unity Vive Wave SDK

Greetings,

 

I will start by explaining my situation.

I'm now working on an application and I'm using two principle assets.

A part of the unity VR sample asset, and the CurvedUI asset.

To make my application working I need to get two things:

#1 - The realtime position and rotation of the controller.

I've already been able to get it by using 

GameObject.Find("MIA_Ctrl").gameObject.transform

 Is there a more "optimized" way to reach this goal?

 

#2 - The realtime input state.

 Here I can't find a way to get trigger/touchpad click event, and I have to admit the documentation is a bit blurry to me.

Is there an equivalent in unity of this native method?

WVR_GetInputButtonState(WVR_DeviceType type, WVR_InputId id)

 

Regards,

 @Tony PH Lin @JustinVive

Vive Staff

Re: Implementing custom controls with Unity Vive Wave SDK

 

You can use keyword “Change Hand Manually” to find parts of sample code. 

The transform you want is

 

 

this.rightController.transform or this.leftController.transform.

Here is the Sample code: Assets/Samples/Controller_Test/Scripts/ControllerTest.cs   (need to import sample.unitypackage)

using wvr; 

// device can be : WVR_DeviceType.WVR_DeviceType_Controller_Right  / WVR_DeviceType.WVR_DeviceType_Controller_Left 
// buttonId can be: WVR_InputId.WVR_InputId_Alias1_Touchpad  / WVR_InputId.WVR_InputId_Alias1_Trigger 

WaveVR_Controller.Input (device).GetPressDown (buttonId) 
WaveVR_Controller.Input (device).GetPressUp (buttonId) 
WaveVR_Controller.Input (device).GetPress (buttonId) 
WaveVR_Controller.Input (device).GetTouchDown (axisId) 
WaveVR_Controller.Input (device).GetTouchUp (axisId) 
WaveVR_Controller.Input (device).GetTouch (axisId)