Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
Inpu's avatar
Inpu
Protege
8 years ago

Detect Right/left/Up/Down on GearVR/Oculus Go touchpad

Hi,

I'm trying to move an object up/down/left/right using the Gear VR/Oculus Go controller. To do that, I need to detect the orientation of the click of the user on the controller.

I'm using the following code :

     if (OVRInput.Get(OVRInput.Button.PrimaryTouchpad))
{
Vector2 coord = OVRInput.Get(OVRInput.Axis2D.PrimaryTouchpad, OVRInput.Controller.RTrackedRemote);

var absX = Math.Abs(coord.x);
var absY = Math.Abs(coord.y);
if (absX > absY)
{
if (coord.x > 0)
//Right
else
//Left
}
else
{
if (coord.y > 0)
//Up
else
//Down
}
}
It's kind of working, but there's sometime a mismatch between the movement. I'm pretty sure that's a math problem here with the coordinates but I can't wrap my head around it.

Thanks :)


3 Replies

Replies have been turned off for this discussion
  • I can only guess what youo mean by 'kind of working', but it may be because there's no 'dead zone'. So you'd look for the abs value to be > 0.75 or whatever, rather than zero.
  • Thanks for coming back to me. I tried increasing the value but I'm still getting mixed result.

    I've find that if I reach the extremities of the remote to press left/right/up/down, it's kinda working fine, but if I'm too close to the middle it's getting inacurate (i.e pressing down act like pressing left, etc)
  • if you using unity then there is script call VRInput.cs this is for swiping but I think it will help you.