我是Unity / Oculus Go的新手 . 我按照Unity教程进行滚动游戏,该游戏适用于计算机 . 我添加OVRCameraRig并将其安装到Oculus Go并且可以看到游戏但无法使用触摸板移动 .
https://unity3d.com/learn/tutorials/s/roll-ball-tutorial
我知道在教程中它说常规InputManager和下面的代码应该适用于VR . InputManager通过按键或操纵杆检测X轴和Y轴的移动,但Oculus Go没有操纵杆 - 所以InputManager可能不支持Go?
我知道Oculus Utilities中有一个OVRInput,但无法弄清楚如何移动播放器对象 . 我可以参考的任何建议或文章?
使用UnityEngine;使用System.Collections;
public class PlayerController:MonoBehaviour {
public float speed;
private Rigidbody rb;
void Start ()
{
rb = GetComponent<Rigidbody>();
}
void FixedUpdate ()
{
float moveHorizontal = Input.GetAxis ("Horizontal");
float moveVertical = Input.GetAxis ("Vertical");
Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
rb.AddForce (movement * speed);
}
}
谢谢!
1 回答
是的,最简单,最“本机”的方式是使用Oculus SDK for Unity3d附带的OVRInput . 您可以观看PC的“滚动球”教程,了解他们如何使用键盘箭头向球添加力,然后您可以用OVRInput替换它 . 这一系列的教程非常棒 . 祝好运 .