I want to create pointer to my game
my tries
1- Create sphere object.
2- Attach this sphere to right eye (RightEyeAnchor).
3- Adapt sphere to have same space from right eye
4- Write code below .
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- Attach right eye code to my script // I am not sure what desired game object
This tutorial that I follow
http://unitygirldev.blogspot.com/2015/01/unity-script-oculus-3d-pointer.html
There is a guide on the Oculus forum that might help you, in particular this section which suggests setting camera to
CenterEyeAnchor
rather thanRightEyeAnchor
:You also need to set render mode to World Space. This can be found on the render mode drop down list for the UI Canvas object: