ViveSoftware / ViveInputUtility-Unity

A toolkit that helps developing/prototyping VR apps.
http://u3d.as/uF7
Other
357 stars 82 forks source link

ViveInput does not work for Oculus Go Touchpad touch position. #144

Closed yanoty3d closed 5 years ago

yanoty3d commented 5 years ago

I can use Input.GetAxis to get touch position on Oculus Go Touchpad, but not with ViveInput. I tried ViveInput.GetPadAxis and a few other combinations, but no success. Am I doing it incorrectly?

chengnay commented 5 years ago

@yanoty3d Which version of Unity, Oculus SDK and VIU you're using? Also please provide Oculus App version too, Go to Oculus App>Settings>General, and scroll to the bottom.

yanoty3d commented 5 years ago

I am using Unity 2019.2.2f1 and Oculus Integration ver 1.4.0 and VIU commit 0cebb42.

By "Oculus App", do you mean the mobile app? It is version 32.0.

By the way, Quest is working fine. Only Go has got this problem.

chengnay commented 5 years ago

@yanoty3d For Oculus Go, OculusVRModule did not have Axis2D for touchpad. I am still trying to find out how to add Axis2D for Touchpad. For controller type, RTrackedRemote or LTrackedRemote, I couldn't find touchpad axis values.

Actually I am referring to the Oculus App on Windows PC. It is ok, I think this information is not related to this issue.

yanoty3d commented 5 years ago

That is exactly the problem I have and I have no idea why. On the other hand, Input.GetAxis("HTC_VIU_UnityAxis4") works fine with Oculus Go.

chengnay commented 5 years ago

Input.GetAxis("HTC_VIU_UnityAxis4") is for pinkycurl and ringcurl, these values are not assigned in OculusVRModule.cs. Do you think these values are correct?

yanoty3d commented 5 years ago

I tested HTC_VIU_UnityAxis4 with my Oculus GO and it is working. Moveover, in Update_R_OculusTouch function in UnityEngineVRModule.cs,

var stickX = GetUnityAxis(4); var stickY = GetUnityAxis(5); and currState.SetAxisValue(VRModuleRawAxis.TouchpadX, stickX); currState.SetAxisValue(VRModuleRawAxis.TouchpadY, -stickY); so, it seems that axis 4, 5 are associated with Touchpad, but somehow it doesn't work with ViveInput class.

chengnay commented 5 years ago

I found the root cause. Please try below method for temporary fix. Change GetControllerState to GetControllerState4. var ctrlState = OVRPlugin.GetControllerState4((uint)OVRPlugin.Controller.RTrackedRemote);

Add below lines for OVRPlugin.Node.HandRight, currState.SetAxisValue(VRModuleRawAxis.TouchpadX, ctrlState.RTouchpad.x); currState.SetAxisValue(VRModuleRawAxis.TouchpadY, ctrlState.RTouchpad.y);

Do the same for HandLeft too, thanks!

yanoty3d commented 5 years ago

Seems to be working well! Many thanks!