cancel
Showing results for 
Search instead for 
Did you mean: 

How to Handle Swipe on Oculus Gear VR touchpad avoiding Tap event

infinite360vr
Explorer
I have a Scroll View containing few buttons as child elements under content-panel. Hierarchy looks like this:

9j7jzd5jz9nr.png

I have implemented OVRTouchpad.TouchHandler event like this on my script attached to ScrollView:

	void Start()	
{
OVRTouchpad.Create();
OVRTouchpad.TouchHandler += HandleTouchHandler;
}

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?
Or is there any other recommended input system that I can use instead of OVR InputModule which knows the difference between swipe and tap?

Any kind of help is highly appreciated.
4 REPLIES 4

ExplainVR
Honored Guest
Hello, has anybody solved this? 

My situation:
In one script for Gear VR I am detecting tap (touch the touchpad) and swipe (swipe on Gear VR touchpad):
Tap - fire weapon (MouseDown)
Swipe - change weapon.
When camera don't rotate (player don't look around), everything is OK.

But when player touch the touchpad - Fire (HandleDown), then rotate head and then release touch (HandleUp), script detects it as a swipe.
Similar as MouseDown -> movement with mouse (look) -> MouseUp.

Could you help me, how to prevent from detecting swipe, when ouy do: HandleDown -> rotate camera (look around) -> HandleUp

EDIT:
Currently I have solution, that I am checking angle between HandleDown - HandleUp < threshold, But there has to be more intuitive and simple solution.

JavedMahmood
Protege
You just code the slider in cs/js, latest Oculus SDK will take care of it automatically! it was nice.

hornyjeans
Honored Guest
I'm experiencing the same issue. Swiping while gazing on UIs triggers the click for buttons. I only intend it to be triggered by click. Anyone has a solution to this? Thanks in advance.

hornyjeans
Honored Guest
In case anyone would need it. I found a solution (?).

I added an additional checker if PrimaryTouchpad is clicked on OVRInputModule.cs

// PointerDown notification

private void ProcessMousePress(MouseButtonEventData data)
{

if (data.PressedThisFrame() && OVRInput.GetDown (OVRInput.Button.PrimaryTouchpad)) {

}
}