Reputation: 21452
how can I detect tap in Gear Vr to make an action
I use unity 5 with C# programming language
my tries
I read answers in untiy3d forums
none of them work to me
http://forum.unity3d.com/threads/samsung-gear-vr-detect-tap-swipe.298346/
any suggestions
Upvotes: 2
Views: 4372
Reputation: 21452
Thanks to @chanibal I find answer
Input.GetMouseButtonDown(0)
but I face another problem , application crush
is there any custom configuration to Gear VR
Upvotes: 1
Reputation: 4662
You have to implement the tap, (or in reality a click, as the touchpad works as a mouse) yourself. A tap is a touch/mouse down, and then a touch/mouse up in a relatively same place.
Here's some untested code that should work (call if it doesn't):
using UnityEngine;
public class ClickDetector:MonoBehaviour {
public int button=0;
public float clickSize=50; // this might be too small
void ClickHappened() {
Debug.Log("CLICK!");
}
Vector3 pos;
void Update() {
if(Input.GetMouseButtonDown(button))
pos=Input.mousePosition;
if(Input.GetMouseButtonUp(button)) {
var delta=Input.mousePosition-pos;
if(delta.sqrMagnitude < clickSize*clickSize)
ClickHappened();
}
}
}
Upvotes: 6