Chefty Posted December 5, 2018 Share Posted December 5, 2018 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 More sharing options...
Tony PH Lin Posted December 10, 2018 Share Posted December 10, 2018 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 More sharing options...
Chefty Posted February 7, 2019 Author Share Posted February 7, 2019 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.