我想弄清楚如何在 Unity3D 5.3.4f 中使用 oculus Remote 。我找到了一些 documentation关于 OVR 映射,但我似乎无法弄清楚。
我想要实现的是单击中间按钮(Button.One)时。
我现在用的就是这行代码
if (OVRInput.GetUp(OVRInput.Button.One))
{
Debug.Log("remote click");
}
但是当我运行该应用程序时出现此错误。
NullReferenceException: Object reference not set to an instance of an object OVRInput.GetUp (Button virtualMask, Controller controllerMask) (at Assets/OVR/Scripts/OVRInput.cs:600) menuButtonHandler.Update () (at Assets/menuButtonHandler.cs:136)
可以在这个脚本中找到
/// <summary>
/// Gets the current up state of the given virtual button mask with the given controller mask.
/// Returns true if any masked button was released this frame on any masked controller and no other masked button is still down this frame.
/// </summary>
public static bool GetUp(Button virtualMask, Controller controllerMask = Controller.Active)
{
return OVRManager.input.GetResolvedButtonUp(virtualMask, RawButton.None, controllerMask);
}
有没有人用过Oculus remote controller unity,可以帮帮我吗?
谢谢,
约翰
最佳答案
在调用 GetUp() 之前,可能需要初始化该方法中的一个对象。
仔细查看您的初始化代码,以及您可能拥有的任何样本——我敢打赌,您不仔细查看就会发现缺少的东西。我不熟悉 Unity API,但如果它们类似于 PC 或移动 C++ API,您很可能错过了一个步骤,或者忘记启动 VR 服务。
关于c# - 如何从 Oculus Remote 获取输入?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37000637/