Jump to content

qxxxb

Verified Members
  • Posts

    3
  • Joined

  • Last visited

Everything posted by qxxxb

  1. 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!
  2. 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: With the fix, the rays will appear in the correct eye like so: If someone could confirm whether this bug is valid, I would appreciate it. Thanks!
  3. I'm trying to calculate the point of convergence by using the gaze rays from the left and right eyes. This is what my script currently looks like: Vector3 LeftGazeOrigin = LeftGazeOriginLocal + Camera.main.transform.position; Vector3 RightGazeOrigin = RightGazeOriginLocal + Camera.main.transform.position; Vector3 LeftGazeDir = Camera.main.transform.TransformDirection(LeftGazeDirLocal); Vector3 RightGazeDir = Camera.main.transform.TransformDirection(RightGazeDirLocal); // Create a gaze plane using three points: // - The left gaze origin // - The right gaze origin // - The midpoint of the gaze origins + the combined (average) gaze // direction Vector3 CombinedGazeDir = (LeftGazeDir + RightGazeDir) / 2; Vector3 MidpointGazeOrigin = (LeftGazeOrigin + RightGazeOrigin) / 2; Vector3 ThirdPoint = MidpointGazeOrigin + CombinedGazeDir; Plane GazePlane = new Plane(RightGazeOrigin, LeftGazeOrigin, ThirdPoint); // Project gaze directions onto the gaze plane. We do this to ensure // that the projected rays will intersect. Vector3 ProjLeftGazeDir = Vector3.ProjectOnPlane(LeftGazeDir, GazePlane.normal); Vector3 ProjRightGazeDir = Vector3.ProjectOnPlane(RightGazeDir, GazePlane.normal); ProjLeftGazeDir.Normalize(); ProjRightGazeDir.Normalize(); // Calculate the intersection of the projected left and right gaze // rays. To do this, we create a plane orthogonal to the gaze plane which // contains the left gaze ray. We then use Unity's `Raycast` function to find // the intersection of this plane and the right gaze ray. Vector3 LeftGazePlaneNormal = Vector3.Cross(GazePlane.normal, ProjLeftGazeDir); LeftGazePlaneNormal.Normalize(); Plane LeftGazePlane = new Plane(LeftGazePlaneNormal, LeftGazeOrigin); Ray RightGazeRay = new Ray(RightGazeOrigin, ProjRightGazeDir); float Enter = 0.0f; if (LeftGazePlane.Raycast(RightGazeRay, out Enter)) { Vector3 Intersection = RightGazeRay.GetPoint(Enter); } After this testing out this script on Unity, it seemed to be working. However, the calculated point of convergence seemed to vary considerably even during fixation. Because of this, I was wondering if anyone had suggestions to improve this script or if anyone had alternative approaches to calculate point of convergence. A common alternative approach I've seen is to create a single combined gaze ray by averaging the left and right gaze origins and directions. The combined gaze ray would then be raycasted to find collisions with other game objects. However, I would prefer a solution which only uses data from the left and right eyes to find the point of convergence.
×
×
  • Create New...