Reputation: 67
I'm trying to get the gaze coordinates from the Hololens. The main idea is get the intersection between my look ray and the Hololens mesh.
Upvotes: 1
Views: 3113
Reputation: 31
Your scene should have a mainCamera object which represents the position of the headset, getting the transform on this object should give you what you are looking for. The snippet below should do it for you.
Camera.mainCamera.gameObject.transform.position
You can check the Unity documentation for cameras here :
https://docs.unity3d.com/ScriptReference/Camera.html
Also check out GazeManager from the Mixed reality toolkit.
Upvotes: 1
Reputation: 1271
All you would need to do is get a reference to the Cursor Game Object and then get its position. That will get you the coordinates for where you are looking at.
public GameObject Cursor;
Vector3 gazePos = Cursor.transform.position;
Upvotes: 1