How to detect a tap or up, down, left, right swipe for Gear VR?
I want to be able to use a tap or swipe as controls for several things in a project on Unity. All I know is that the touchpad on the Gear VR simulates a mouse, but i don't get how it would be detected. This is the Gear VR for GS6, S6 edge, S6 edge+ and Note 5. Not the Note 4.
ps. I am still a beginner in Unity, so please try to keep any explanation simple if you can
Answer by drawtheplay · Feb 06, 2016 at 03:16 PM
Gear VR handles input processing that you can tie into check their documentation. https://developer.oculus.com/documentation/game-engines/latest/concepts/unity-ovrinput/
This only explains the use of a controller, but not the touchpad on the side of the Gear VR,
Answer by trevorchico · Feb 08, 2017 at 05:25 PM
First download and import "Oculus Utilities for Unity 5" v1.10
https://developer3.oculus.com/downloads/
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.SingleTap)
{
text2.text = "TAP!";
}
if (touchArgs.TouchType == OVRTouchpad.TouchEvent.Down)
{
text2.text = "Down!";
}
if (touchArgs.TouchType == OVRTouchpad.TouchEvent.Up)
{
text2.text = "UP!";
}
if (touchArgs.TouchType == OVRTouchpad.TouchEvent.Right)
{
text2.text = "Right!";
}
if (touchArgs.TouchType == OVRTouchpad.TouchEvent.Left)
{
text2.text = "Left!";
}
}
}
This doesnt work with Coroutines or even with changing a scene, It really destroy previous scene Gameobject, Audio...etc. I think the OVRTouchpad.cs is destroying objects.
Answer by maaz0011 · Sep 13, 2017 at 03:47 PM
this script is not working , to make a single tap i used input (Input.GetKeyUp(KeyCode.Mouse0))
it worked in my case but to make a swipe input i tried y axis as it done in mobile touch
Your answer
Follow this Question
Related Questions
Samsung Gear VR – Virtual reality device 1 Answer
[VR] How to make an active rigidbody work in VR, similar to how Nimsony or Boneworks does it? 1 Answer
Why do objects clip through eachother in VR (XR)? (Oculus quest 2) 0 Answers
Gear VR S6 shadow issue 0 Answers
How can i make a prefab solid using trigger and VR 0 Answers