Forum Discussion
Inpu
8 years agoProtege
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
- MarkHenryCProtegeI 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.
- InpuProtegeThanks 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) - play_eduExplorerif you using unity then there is script call VRInput.cs this is for swiping but I think it will help you.
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 10 years ago
- 9 years ago