Jump to content
 
qxxxb

Gaze origin bug in GetGazeRay of Unity package

Recommended Posts

Hi, there seems to be a bug in the `GetGazeRay` function of the SRanipal Unity package (specifically, the function at line 265 in SRanipal_Eye.cs).

origin = eyesData[(int)gazeIndex].gaze_origin_mm * 0.001f;
direction = eyesData[(int)gazeIndex].gaze_direction_normalized;
origin.x *= -1; // Adding this line fixes the bug
direction.x *= -1;

This issue has been mentioned in this post as well.

Here is a demo script to illustrate the bug: GazeRays.cs

This will render a blue ray from the left eye and a red ray from the right eye. Without the fix, the rays will appear swapped like so:

no_fix.thumb.png.90bd8710f952e7021aedeef95394fbcf.png

With the fix, the rays will appear in the correct eye like so:

fix.thumb.png.700d24a73724f9b0886194665c113a16.png

If someone could confirm whether this bug is valid, I would appreciate it. Thanks!

Share this post


Link to post
Share on other sites

Sorry to bump the topic, but if someone could evaluate the bug and see if the fix I mentioned resolves it, that's be great. Thanks!

Share this post


Link to post
Share on other sites

The same bug applies to the combined gazeray. When I move my gaze to the left the ray goes to the right and vice versa. Up/down is fine.

If gaze_orgin_C is the measured combined origin and gaze_direct_C the measured combined direction you need to do the below calculation to use it:

fixed_gaze_origin_C = new Vector3(gaze_origin_C.x*-1f, gaze_origin_C.y, gaze_origin_C.z)/1000f,
fixed_gaze_direction_C = new Vector3(gaze_direct_C.x*-1f, gaze_direct_C.y, gaze_direct_C.z),

Note the division by 1000, as I'm using version 2 of the eyetracking API and there the measured values are in mm and Unity units are meters.

Share this post


Link to post
Share on other sites

Please sign in to comment

You need to be a member in order to leave a comment

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...