我是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;
公共类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);
}}
谢谢!
发布于 2018-06-05 15:01:08
是的,最简单也是最“原生”的方式是使用Oculus SDK for Unity3d附带的OVRInput。你可以观看PC版的“滚球”教程,看看他们是如何使用键盘上的箭头来增加球的力量的,然后你就可以用OVRInput替换它了。这一系列的教程非常棒。祝好运。
https://stackoverflow.com/questions/50691501
复制相似问题