1
我正在使用来自Unity https://www.assetstore.unity3d.com/en/#!/content/51519
的VR示例与场景“Shooter 360”(尽管我尝试了其他场景)。我无法在Unity VR示例场景中的播放模式中移动光标
我在Mac和XR设置中我支持'模拟HMD-HTC'和'Oculus SDK'。
当我按Play时,我无法移动光标或根本不能与GUI交互。任何建议?
我正在使用来自Unity https://www.assetstore.unity3d.com/en/#!/content/51519
的VR示例与场景“Shooter 360”(尽管我尝试了其他场景)。我无法在Unity VR示例场景中的播放模式中移动光标
我在Mac和XR设置中我支持'模拟HMD-HTC'和'Oculus SDK'。
当我按Play时,我无法移动光标或根本不能与GUI交互。任何建议?
默认情况下它是SDK您使用在运行时(纸板,Oculus公司,HTC万岁,...)旋转的摄像头。
您可以使用脚本在编辑模式下旋转相机。以下是一个示例,只需将此脚本分配给您的相机并按下左Ctrl,同时在编辑器窗口中移动鼠标:
public class EditorCameraController : MonoBehaviour
{
public float sensitivityX = 15F;
public float sensitivityY = 15F;
public float minimumX = -360F;
public float maximumX = 360F;
public float minimumY = -60F;
public float maximumY = 60F;
private float rotationX = 0F;
private float rotationY = 0F;
private Quaternion originalRotation;
void Start()
{
originalRotation = transform.localRotation;
}
void Update()
{
if (Input.GetKey(KeyCode.LeftControl))
{
rotationX += Input.GetAxis("Mouse X") * sensitivityX;
rotationY += Input.GetAxis("Mouse Y") * sensitivityY;
rotationX = ClampAngle(rotationX, minimumX, maximumX);
rotationY = ClampAngle(rotationY, minimumY, maximumY);
Quaternion xQuaternion = Quaternion.AngleAxis(rotationX, Vector3.up);
Quaternion yQuaternion = Quaternion.AngleAxis(rotationY, -Vector3.right);
transform.localRotation = originalRotation * xQuaternion * yQuaternion;
}
}
public static float ClampAngle(float angle, float min, float max)
{
if (angle < -360F)
angle += 360F;
if (angle > 360F)
angle -= 360F;
return Mathf.Clamp(angle, min, max);
}
}