我想创建指向我的游戏的指针
我的尝试
1- 创建球体对象。
2-将此球体连接到右眼(RightEyeAnchor)。
3-使球体与右眼具有相同的空间
4-在下面写代码。
using UnityEngine;
using System.Collections;
public class Pointer_Mock : MonoBehaviour {
public GameObject targetCam;
// Use this for initialization
void Start () {
targetCam = transform.parent.gameObject;
}
void Update() {
transform.LookAt (targetCam.transform);
float localX = transform.localPosition.x;
float localY = transform.localPosition.y;
float h = (localX += (Input.GetAxis("Mouse X") * 0.05f));
float v = (localY += (Input.GetAxis("Mouse Y") * 0.05f));
transform.localPosition = new Vector3 (h, v, transform.localPosition.z);
}
}
5-将右眼代码附加到我的脚本 // I am not sure what desired game object
我遵循的本教程
http://unitygirldev.blogspot.com/2015/01/unity-script-oculus-3d-pointer.html