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;
}
}
'🌍 Unity > VR, AR' 카테고리의 다른 글
유니티 오큘러스 빌드, 인풋세팅 (0) | 2016.08.19 |
---|---|
페이스북, 유튜브 360동영상 업로드하기 (0) | 2016.08.01 |
[임시저장] 오큘러스 Utility 연구 (0) | 2016.06.06 |
Public VR Critique #5: Bazaar 의 번역문 (0) | 2016.06.04 |
GearVR 빌드하기! 유니티 5.3.4f 버전 (0) | 2016.06.02 |