Jump to content
Happy Holidays! Limited Staff Responses: 1/20 - 1/31 ×

Implementing custom controls with Unity Vive Wave SDK


Chefty
 Share

Recommended Posts

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,

  

Link to comment
Share on other sites

 

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) 

 

 

 

Link to comment
Share on other sites

  • 1 month later...

Thanks for your help,

 

I finally managed to make it work with your leads.

I had to use the default WaveVR prefab, I attached the WaveVR_ControllerLoader.cs script to the head.

Then I implemented the following listener:

WaveVR_Utils.Event.Listen(WaveVR_Utils.Event.CONTROLLER_MODEL_LOADED, OnControllerLoaded);

Where I assigned the loaded controller to a GameObject.

Then, as you mentionned, I used this GO to get transform properties:

this.rightController.transform.rotation;this.rightController.transform.position;

And input properties:

WaveVR_Controller.Input(m_wvrDevice).GetPressDown(WVR_InputId.WVR_InputId_Alias1_Touchpad);

Sorry for the late reply.

Regards,

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...