Pinkrush Posted January 12 Share Posted January 12 Hi, I implemented the eyetracking in Unity like it is proposed in the Vive Tutorial (https://developer.vive.com/resources/openxr/openxr-pcvr/tutorials/unity/integrate-facial-tracking-your-avatar/). The eye tracking works in principle but it is slightly off. It gravitates to the left. Any ideas why this happens? I used this code to get the lookat position: if (NeededToGetData) { facialManager.GetWeightings(out EyeWeightings); Vector3 LeftEye = Vector3.zero; Vector3 RightEye = Vector3.zero; Vector3 GazeDirectionCombinedLocal = Vector3.zero; if (EyeWeightings[XrEyeShapeHTC.XR_EYE_EXPRESSION_LEFT_IN_HTC] > EyeWeightings[XrEyeShapeHTC.XR_EYE_EXPRESSION_LEFT_OUT_HTC]) { GazeDirectionCombinedLocal.x = EyeWeightings[XrEyeShapeHTC.XR_EYE_EXPRESSION_LEFT_IN_HTC]; } else { GazeDirectionCombinedLocal.x = -EyeWeightings[XrEyeShapeHTC.XR_EYE_EXPRESSION_LEFT_OUT_HTC]; } if (EyeWeightings[XrEyeShapeHTC.XR_EYE_EXPRESSION_LEFT_UP_HTC] > EyeWeightings[XrEyeShapeHTC.XR_EYE_EXPRESSION_LEFT_WIDE_HTC]) { GazeDirectionCombinedLocal.y = -EyeWeightings[XrEyeShapeHTC.XR_EYE_EXPRESSION_LEFT_UP_HTC]; } else { GazeDirectionCombinedLocal.y = EyeWeightings[XrEyeShapeHTC.XR_EYE_EXPRESSION_LEFT_WIDE_HTC]; } GazeDirectionCombinedLocal.z = (float)1.0; LeftEye = Quaternion.Euler(cam.transform.localEulerAngles) * GazeDirectionCombinedLocal; if (EyeWeightings[XrEyeShapeHTC.XR_EYE_EXPRESSION_RIGHT_IN_HTC] > EyeWeightings[XrEyeShapeHTC.XR_EYE_EXPRESSION_RIGHT_UP_HTC]) { GazeDirectionCombinedLocal.x = -EyeWeightings[XrEyeShapeHTC.XR_EYE_EXPRESSION_RIGHT_IN_HTC]; } else { GazeDirectionCombinedLocal.x = EyeWeightings[XrEyeShapeHTC.XR_EYE_EXPRESSION_RIGHT_UP_HTC]; } if (EyeWeightings[XrEyeShapeHTC.XR_EYE_EXPRESSION_RIGHT_UP_HTC] > EyeWeightings[XrEyeShapeHTC.XR_EYE_EXPRESSION_RIGHT_DOWN_HTC]) { GazeDirectionCombinedLocal.y = EyeWeightings[XrEyeShapeHTC.XR_EYE_EXPRESSION_RIGHT_UP_HTC]; } else { GazeDirectionCombinedLocal.y = -EyeWeightings[XrEyeShapeHTC.XR_EYE_EXPRESSION_RIGHT_DOWN_HTC]; } GazeDirectionCombinedLocal.z = (float)1.0; RightEye = Quaternion.Euler(cam.transform.localEulerAngles) * GazeDirectionCombinedLocal; Debug.Log($"Left x {LeftEye.x} Right x {RightEye.x} diff = {LeftEye.x - RightEye.x} __ LeftEye ? Right {Mathf.Approximately(LeftEye.x, RightEye.x) },{Mathf.Approximately(LeftEye.y, RightEye.y)}, {Mathf.Approximately(LeftEye.z, RightEye.z)}"); lookAtDir = (LeftEye + RightEye) / 2; Link to comment Share on other sites More sharing options...
Pinkrush Posted February 6 Author Share Posted February 6 This is fixed with the new plugin: VIVE OpenXR Unity Plugin 1.0.10 Link to comment Share on other sites More sharing options...
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