Jump to content

Gaze origin and direction issue from GetGazeRay in Unreal Plugin


Recommended Posts

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!

Edited by Krattrym
Link to comment
Share on other sites

@Krattrym If I divide by 1000 to convert into meter then I get all zero as gaze origin vector values are smaller. I actually need to calculate distance between object position in the scene and gaze origin where I got mostly static distance by using conversion. Any other way how to handle it? 

 

Thanks in advance.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...