Unity3d 如何在unity mobile VR(谷歌VR)中获取头部运动轴?

Unity3d 如何在unity mobile VR(谷歌VR)中获取头部运动轴?,unity3d,google-vr,google-vr-sdk,Unity3d,Google Vr,Google Vr Sdk,我有一个UI按钮,当鼠标向下按时,它会旋转场景中的对象,当鼠标按下时,它会停止旋转 我使用以下代码旋转对象: private float rotationSpeed = 205f; public void dragBrain(GameObject brain) { float rotateX = Input.GetAxis("Mouse X") * rotationSpeed * Mathf.Deg2Rad; float rotateY = Input.GetA

我有一个UI按钮,当鼠标向下按时,它会旋转场景中的对象,当鼠标按下时,它会停止旋转

我使用以下代码旋转对象:

private float rotationSpeed = 205f;

public void dragBrain(GameObject brain) {
        float rotateX = Input.GetAxis("Mouse X") * rotationSpeed * Mathf.Deg2Rad;
        float rotateY = Input.GetAxis("Mouse Y") * rotationSpeed * Mathf.Deg2Rad;

        theObjectToRotate.transform.Rotate(Vector3.up, -rotateX);
        theObjectToRotate.transform.Rotate(Vector3.right, -rotateY);

    }
当我使用unity测试应用程序时,它运行良好(没有VR),但是当我构建项目并在Android设备上测试它时,当我单击按钮时,对象不会旋转

是因为我想得到鼠标的轴吗?和虚拟现实有什么不同


我该怎么做呢?因为我试图查找文档,但运气不佳。

在移动设备上,您不能使用鼠标。。相反,你必须使用触摸输入。还有@derHugo谢谢,我来看看it@derHugo谢谢你,它成功了,你能给我一个正确的答案让我接受吗