infinite360vr
9 years agoExplorer
How to Handle Swipe on Oculus Gear VR touchpad avoiding Tap event
I have a Scroll View containing few buttons as child elements under content-panel. Hierarchy looks like this:
I have implemented OVRTouchpad.TouchHandler event like this on my script attached to ScrollView:
void Start() { #if OVR && !UNITY_EDITOR OVRTouchpad.Create(); OVRTouchpad.TouchHandler += HandleTouchHandler; #endif }
void HandleTouchHandler (object sender, System.EventArgs e) { OVRTouchpad.TouchArgs touchArgs = (OVRTouchpad.TouchArgs)e; if(touchArgs.TouchType == OVRTouchpad.TouchEvent.Left || touchArgs.TouchType == OVRTouchpad.TouchEvent.Up) { // Code to scroll UP for swipe in directions LEFT/UP } else if(touchArgs.TouchType == OVRTouchpad.TouchEvent.Right || touchArgs.TouchType == OVRTouchpad.TouchEvent.Down) { // Code to scroll DOWN for swipe in directions RIGHT/DOWN } }
Problem :
As I am using OVR Input Module, it processes Tap input even if I try to swipe. So every time I swipe in any direction while gazing at button (child of scroll view). Button is clicked taking me to some other menu. I am not sure if this is desired behaviour of Gear VR Input system. As I have seen in Oculus Home App (and other apps on store) it only scrolls without triggering clicks on child element.
Is there any way to prevent click/tap if swipe is detected?
Any kind of help is highly appreciated.