- Home /
How to make the swipe on Oculus Go
Hi everyone, i'm new on Unity. I'm trying to program, on the Oculus Go, the various interactions with the motion controller (take an object, launch it, select it, etc ...) but I can't find the codes for the "swipe". I want to try to make sure that an object, when selected with the pointer, can rotate with the touchpad. I tried to look for examples but I did't find anything, there is someone who can help me?
Answer by mgill4 · Jun 20, 2018 at 03:34 PM
this link could help you out?: https://developer.oculus.com/documentation/unity/latest/concepts/unity-ovrinput/#unity-ovrinput
plenty of info in it but if you go down halfway it show's what to use for the go controllers. There are some examples there too but I haven't used it before.
Hope this helps!
Answer by Behisoft · Oct 20, 2018 at 04:09 PM
Right now there is no "swipe" information available in OVRInput. All you have access to is the position of person's thumb on the touchpad at any given frame. You can use that information and process (there are lots of different ways) to get swipe information. However, for purpose of rotating an object using the touchpad you might not need to get swipe info and just reading the Axis values from touchpad might be sufficient.
Answer by jeremyinteractive · Aug 18, 2019 at 06:34 PM
Here's the code for left and right click, which I like more than swipe for ergonomics and coding.
//Left and Right Touch Clicking
if(OVRInput.Get(OVRInput.Button.PrimaryTouchpad)){
Vector2 primaryTouchpad = OVRInput.Get(OVRInput.Axis2D.PrimaryTouchpad);
if(primaryTouchpad.x > 0f){
NextWeapon();
} else if (primaryTouchpad.x < 0f){
PreviousWeapon();
}
}
You can probably make a looping wait function that polls the vectors on a short interval then compares the values to determine direction of swipe. Hope this really helps. Checkout my blog https://smithvr.home.blog