Skip to main content
Up and Coming
June 24, 2018

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 :)


This topic has been closed for replies.

3 replies

Up and Coming
June 25, 2018
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.
InpuAuthor
Up and Coming
June 26, 2018
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)
July 2, 2018
if you using unity then there is script call VRInput.cs this is for swiping but I think it will help you.