how to get eye position and rotation steamvr

hey I am making a game where there are portals and I need to get both eyes position and rotation
to get the portal effect.

how do I get individual eye positions? thanks in advance.

Latest Unity XR (mixed and virtual reality) documentation for getting input: Unity - Scripting API: InputTracking


Since it’s fairly new, it isn’t very detailed. Also I’ve never done this before, but give this code snippet a go. It compiles for me but I don’t have a VR headset to test it with.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.XR;

public class xrnodetest : MonoBehaviour
{
    public List<XRNodeState> nodeStates;
    private XRNodeState single_xrnode;

    private Vector3 left_eye_pos, right_eye_pos;
    private Quaternion left_eye_rot, right_eye_rot;

    // Start is called before the first frame update
    void Start()
    {
        nodeStates = new List<XRNodeState>();

        // Add left eye node to the nodeStates list, which will be represented by nodeStates[0]
        single_xrnode.nodeType = XRNode.LeftEye;
        nodeStates.Add(single_xrnode);

        // Add right eye node to the nodeStates list, which will be represented by nodeStates[1]
        single_xrnode.nodeType = XRNode.RightEye;
        nodeStates.Add(single_xrnode);

    }

    // Update is called once per frame
    void Update()
    {
        InputTracking.GetNodeStates(nodeStates);

        // Try to get the parameters and place them into the correct variables
        nodeStates[0].TryGetPosition(out left_eye_pos);
        nodeStates[0].TryGetRotation(out left_eye_rot);

        nodeStates[1].TryGetPosition(out right_eye_pos);
        nodeStates[1].TryGetRotation(out right_eye_rot);


        Debug.Log("Left eye position: " + left_eye_pos);
        Debug.Log("Left eye rotation: " + left_eye_rot);
        Debug.Log("Right eye position: " + right_eye_pos);
        Debug.Log("Right eye rotation: " + right_eye_rot);

    }
}

that seems to be for unity 5.6 I am using the latest version of unity.

and I can’t access InputTracking it does not appear for me.