我想創建指向我的遊戲三星齒輪VR - 創建魔環3D指針
我嘗試
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
是否設置渲染模式,以世界空間? – Robert
我該怎麼辦呢 –
我在下面的答案中增加了更多的細節。 – Robert