Valentin Posted June 4, 2023 Posted June 4, 2023 Hi team, I am a PhD student facing an issue with Eye Tracking VR development. I'm using the HTC Vive Pro Eye in Unity with the Srananipal SDK. In my C# script, I am able to obtain the gaze location in world coordinates. It works fine when I don't move my head. However, when I move my head (translation + rotation), the headset movement is not compensated. I've attempted to compensate for it using the main camera movement, but I haven't been successful. Here's a snippet of my C# script: var tL = (1 / leftGlobalDirection.z) * (distance - leftGlobalOrigin.z); leftGazeWorld = leftGlobalOrigin + tL * leftGlobalDirection; In the above code, tL represents the distance between the main camera and the object (named Object1). I have tried modifying this line, but the results are not correct. My goal is to compensate for the main camera movement to ensure accurate data. I've tried compensating using the main camera direction from Object1 and the main camera direction. I appreciate any help or suggestions you can provide. Best regards,
Helinafoster5 Posted July 13, 2023 Posted July 13, 2023 (edited) Update Gaze Calculation, Convert Gaze Direction to World Space, Apply Camera Positions. Add the position of the main camera to the gaze origin point (leftGlobalOrigin) to account for the headset's translation in world space. Here's an example of how the updated code snippet might look. mcdvoice Vector3 gazeDirection = GetGazeDirection(); // Obtain gaze direction from Srananipal SDK Vector3 worldGazeDirection = mainCamera.transform.rotation * gazeDirection; // Convert to world space float tL = (1 / worldGazeDirection.z) * (distance - leftGlobalOrigin.z); Vector3 leftGazeWorld = mainCamera.transform.position + tL * worldGazeDirection; n this code, mainCamera represents the reference to the main camera in your scene. By incorporating the rotation and translation of the main camera in the gaze calculation, you should be able to compensate for the headset movement accurately. Remember to ensure that you're using the correct reference points and coordinate systems for your specific implementation. Edited July 13, 2023 by Helinafoster5
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now