Skip to content
Snippets Groups Projects
Commit aeb63dae authored by valentin.dasbach's avatar valentin.dasbach
Browse files

Corrections for gaze tracking with vive pro eye

parent ea345be8
No related branches found
No related tags found
No related merge requests found
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "GazeTracking/SFGazeTarget.h" #include "GazeTracking/SFGazeTarget.h"
#include "GazeTracking/SFGazeTargetActor.h" #include "GazeTracking/SFGazeTargetActor.h"
#include "Help/SFUtils.h" #include "Help/SFUtils.h"
#include "Logging/SFLoggingUtils.h"
#ifdef WITH_SRANIPAL #ifdef WITH_SRANIPAL
#include "SRanipalEye_FunctionLibrary.h" #include "SRanipalEye_FunctionLibrary.h"
...@@ -168,10 +169,34 @@ FGazeRay USFGazeTracker::GetLocalGazeDirection() ...@@ -168,10 +169,34 @@ FGazeRay USFGazeTracker::GetLocalGazeDirection()
FGazeRay USFGazeTracker::GetWorldGazeDirection() FGazeRay USFGazeTracker::GetWorldGazeDirection()
{ {
if (GazeTrackingBackend == EGazeTrackingBackend::OpenXREyeTracker) { if (GazeTrackingBackend == EGazeTrackingBackend::OpenXREyeTracker) {
//this is already in world coordinates //this is already in world coordinates
return GetGazeRayFromEyeTrackerData(); FGazeRay Gaze = GetGazeRayFromEyeTrackerData();
// Corrections when using HTC Vive Pro Eye
UWorld* World = USFGameInstance::Get()->GetWorld();
if (!World->GetFirstPlayerController()) {
return FGazeRay();
} }
const APlayerCameraManager* CamManager = World->GetFirstPlayerController()->
PlayerCameraManager;
const FVector CameraLocation = CamManager->GetCameraLocation();
FRotator CameraRotation = CamManager->GetCameraRotation();
Gaze.Origin = CameraLocation;
FRotator AddRot = FRotator(0.0f, 180.0f, 0.0f);
Gaze.Direction = AddRot.RotateVector(Gaze.Direction);
Gaze.Direction = World->GetFirstPlayerController()->GetControlRotation().UnrotateVector(Gaze.Direction);
Gaze.Direction = CameraRotation.RotateVector(Gaze.Direction);
return Gaze;
}
//otherwise take local and transform it into world space //otherwise take local and transform it into world space
FGazeRay LocalGazeRay = GetLocalGazeDirection(); FGazeRay LocalGazeRay = GetLocalGazeDirection();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment