gpt4 book ai didi

c# - 构建项目后无法旋转相机和 Head Unity 3D

转载 作者:行者123 更新时间:2023-11-30 00:22:02 25 4
gpt4 key购买 nike

在Unity中,我可以正常播放这个项目,ALT + 鼠标 = 左右看,上下看,CTRL = 倾斜头部并行走。但是当我将这个项目构建到 APK 或 PC (Windows) 时,头部不能左右转动

这是我的 Auto Walk 源代码,

公共(public)类 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);
}
}

最佳答案

您需要在构建之前检查播放器设置中的虚拟现实支持勾选

关于c# - 构建项目后无法旋转相机和 Head Unity 3D,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46110948/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com