【问题标题】:Utilizing the touchpad on gearVR in Unity在 Unity 中使用 gearVR 上的触摸板
【发布时间】:2016-08-09 09:39:19
【问题描述】:

仍然在这里学习并从基础开始(只是一个普通的飞机并以第一人称移动) 但是,我可以运行该应用程序并上下左右查看等,但在触摸 GearVR 耳机上的触摸板时无法使相机移动。

我已经创建了脚本(c#)并统一附加到相机上:

using UnityEngine;
using System.Collections;

public class Moving : MonoBehaviour {

// Use this for initialization
void Start()
{
    if (Input.GetButton("Tap"))
    {
        // Do something if tap starts
    }

    if (Input.GetButtonUp("Tap"))
    {
        // Do something if tap ends

    }
}

    // Update is called once per frame
    void Update () {
    if (Input.GetButton("Tap"))
    {
        // Do something if tap starts
    }

    if (Input.GetButtonUp("Tap"))
    {
        // Do something if tap ends
    }

}
}

但它似乎仍然不起作用。当我构建并运行应用程序时,它什么也不做:-(

我知道我做错了什么,但不确定是什么。

【问题讨论】:

    标签: c# unity3d


    【解决方案1】:

    在 Oculus Gear VR 中处理单击:

    void Start()
    {
        OVRTouchpad.Create();
        OVRTouchpad.TouchHandler += OVRTouchpad_TouchHandler;
    }
    
    
    void OVRTouchpad_TouchHandler (object sender, System.EventArgs e)
    {
        OVRTouchpad.TouchArgs touchArgs = (OVRTouchpad.TouchArgs)e;
        OVRTouchpad.TouchEvent touchEvent = touchArgs.TouchType;
        if(touchArgs.TouchType == OVRTouchpad.TouchEvent.SingleTap)
        {
            // Your response to Tap goes here.
        }
    }
    

    点击并按住移动:

    1. 您需要在this tutorial.之后的输入中注册Tapkey
    2. 添加 OVRPlayerController 预制件以在场景中移动。这会 让您在 Unity 编辑器中使用键盘 W/A/S/D 键移动。
    3. 接下来您需要将 Tap key 与 OVR Player 控制器脚本集成 向前迈进。

    这里有一些有用的链接:

    http://forum.unity3d.com/threads/gear-vr-touchpad-fps-script.373103/

    http://rifty-business.blogspot.co.uk/2014/04/unity-pro-4-using-ovrcameracontroller.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-05-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-10-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多