Jump to content

Krattrym

Verified Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by Krattrym

  1. Hello,

    I think there still is an issue with GetGazeRay in the Unreal SDK.

    The following two posts already address this issue and there is a fix now in the version i am using (SDK-v1.3.3.0) and this fix is based on the bug fix suggested in the first post (Gaze origin bug in GetGazeRay of Unity package). This means the x-direction is just multiplied by -1:

    origin.x *= -1; // Adding this line fixes the bug
    direction.x *= -1;

     

    Now the issue is that this fix works fine for Unity since the coordinate system is a left-handed, Y-Up coordinate system (see also: A Guide to Unity’s Coordinate System (With Practical Examples) – techarthub ). However, Unreal is a left-handed, Z-Up coordinate system. This means that the fix for Unity is not valid for Unreal which i can confirm based on my own observations.

    So the fix for the direction in Unreal would simply be:

    direction.Y *= -1;

     

    Furthermore, for the origin of the eyes the SRanipal SDK uses a right-handed coordinate system:

    in SRanipal_Eyes_Enums.h

    /** The point in the eye from which the gaze ray originates in millimeters.(right-handed coordinate system)*/
    FVector gaze_origin_mm;

    is used in SRanipal_Core.cpp

    origin = singeEyeDatas[(int)gazeIndex].gaze_origin_mm / 1000;
    ...
    CovertToUnrealLocation(origin);

    The ConvertToUnrealLocation(origin) translates the SDK coordinate system to the Unreal coordinate system but still the values along the Unreal y-axis are flipped. 

    That is why i also included this:

    origin.Y *= -1;

     

    So my complete fix looks like this:

    origin = singeEyeDatas[(int)gazeIndex].gaze_origin_mm / 1000;
    direction = singeEyeDatas[(int)gazeIndex].gaze_direction_normalized;
    // direction.X *= -1; is the fix for the origin bug in Unity. However, Unreal uses a different coordinate system.
    // that is why line direction.X *= -1; is commented 
    //direction.X *= -1;
    CovertToUnrealLocation(origin);
    ApplyUnrealWorldToMeterScale(origin);
    CovertToUnrealLocation(direction);
    origin.Y *= -1;
    direction.Y *= -1;

     

    Please, just tell me if that is correct or if i am missing something here... (or i am just repeating a post i did not find 🙂 )

    Thank you!

×
×
  • Create New...