构建项目后无法旋转相机和头部Unity 3D



在Unity中,我可以正确播放此项目,alt 鼠标=向左,向右,上下看,ctrl =倾斜的头和步行。但是,当我将此项目构建为APK或PC(Windows)时,头部无法向左或右旋转

这是我自动步行的源代码,

公共类Vrautowalk

// Update is called once per frame
void Update () {
    // player is allowed to move
    // using Google VR button or Touchpad in Gear VR
    if (Input.GetButtonDown("Fire1")) {
        moveForward = !moveForward;
        if (moveForward == false) {
            myCC.SimpleMove(Vector3.zero);
        }
    }
    // if ALT button is pressed, rotate head
    if (Input.GetKey(KeyCode.RightAlt) || Input.GetKey(KeyCode.LeftAlt))
    {
        // Get mouse X input
        mouseX += Input.GetAxis("Mouse X") * 5;
        // Keep mouseX value between 0 and 360
        if (mouseX <= -180) { mouseX += 360; }
        else if (mouseX > 180) { mouseX -= 360; }
        // Get mouse Y input
        mouseY += Input.GetAxis("Mouse Y") * 2.4f;
        // Keep mouseY value between 0 and 360
        if (mouseY <= -180) { mouseY += 360; }
        else if (mouseY > 180) { mouseY -= 360; }
    }
    // Check to see if I should move
    if (moveForward) {
        // Find the forward direction
        Vector3 forward = vrCamera.TransformDirection(Vector3.forward);
        // tell myCC to move forward
        myCC.SimpleMove(forward * speed);
    }
}

您需要在构建

之前检查播放器设置中的虚拟现实受支持的刻度

最新更新