2016
06.07

http://talesfromtherift.com/gearvr-input-touchpad/


결론부터 말하자면, 기어 VR은 


터치 : Input.GetMouseButtonDown(0)


백버튼 : Input.GetKeyDown(KeyCode.Escape)


Mouse X

Mouse Y 를 Swipe로 인식받는다.


이거를 그대로 키에다가 써주는 방법이 1번.




2번은 OVR 유틸리티에 포함된 OVRTouchPad 스크립트를 이용하는방법.


씬내에 게임오브젝트 하나 생성하고, 아래와 같은 스크립트를달아주면 된다.




void Start () {

OVRTouchpad.Create();

OVRTouchpad.TouchHandler += HandleTouchHandler;

}

private void HandleTouchHandler(object sender, System.EventArgs e)

{

OVRTouchpad.TouchArgs touchArgs = (OVRTouchpad.TouchArgs)e;

if (touchArgs.TouchType == OVRTouchpad.TouchEvent.SingleTap) {


}


if (touchArgs.TouchType == OVRTouchpad.TouchEvent.Up) {


}



if (touchArgs.TouchType == OVRTouchpad.TouchEvent.Down) {


}



if (touchArgs.TouchType == OVRTouchpad.TouchEvent.Left) {


}



if (touchArgs.TouchType == OVRTouchpad.TouchEvent.Right) {


}

}



 이게 더 상세하네..





더블 클릭 스크립트.

http://gamedev.stackexchange.com/questions/116455/how-to-properly-differentiate-single-clicks-and-double-click-in-unity3d-using-c



float _threshold = 0.25f;

void Start ()
{
    StartCoroutine ("DetectTouchInput");
}

IEnumerator DetectTouchInput ()
{
    while (true) {
        float duration = 0;
        bool doubleClicked = false;
        if (Input.GetMouseButtonDown (0)) {
            while (duration < _threshold) {
                duration += Time.deltaTime;
                yield return new WaitForSeconds (0.005f);
                if (Input.GetMouseButtonDown (0)) {
                    doubleClicked = true;
                    duration = _threshold;
                    // Double click/tap
                    print ("Double Click detected");
                }
            }
            if (!doubleClicked) {
                // Single click/tap
                print ("Single Click detected");
            }
        }
        yield return null;
    } 

}