Skip to content

Commit

Permalink
Updated Unity Script to make sure data is always recorded unfiltered
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomahawkuru committed Jul 8, 2021
1 parent 00979cb commit 64e4a1e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 27 deletions.
7 changes: 0 additions & 7 deletions Unity/Eye Tracking.prefab.meta

This file was deleted.

27 changes: 7 additions & 20 deletions Unity/EyeTracking.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,10 @@ public class EyeTracking : MonoBehaviour
[Header("Gaze calibration settings")]
public VarjoEyeTracking.GazeCalibrationMode gazeCalibrationMode = VarjoEyeTracking.GazeCalibrationMode.Fast;
public KeyCode calibrationRequestKey = KeyCode.Space;
public bool LogAfterCalibration = true;

[Header("Start logging after calibration")]
public bool BeginLogging = true;

[Header("Gaze output filter settings")]
public VarjoEyeTracking.GazeOutputFrequency gazeOutputFrequency = VarjoEyeTracking.GazeOutputFrequency.Frequency100Hz;

[Header("Gaze output filter settings")]
public VarjoEyeTracking.GazeOutputFilterType gazeOutputFilterType = VarjoEyeTracking.GazeOutputFilterType.None;
public KeyCode setOutputFilterTypeKey = KeyCode.RightShift;
[Header("Gaze output frequency setting (if available)")]
public VarjoEyeTracking.GazeOutputFrequency gazeOutputFrequency = VarjoEyeTracking.GazeOutputFrequency.MaximumSupported;

[Header("Toggle gaze target visibility")]
public bool showGazeTarget = false;
Expand Down Expand Up @@ -141,8 +135,9 @@ private void Start()
VarjoEyeTracking.SetGazeOutputFrequency(gazeOutputFrequency);
Debug.Log("Gaze output frequency is now: " + VarjoEyeTracking.GetGazeOutputFrequency());

//make sure filtering is off
VarjoEyeTracking.GazeOutputFilterType gazeOutputFilterType = VarjoEyeTracking.GazeOutputFilterType.None;
VarjoEyeTracking.SetGazeOutputFilterType(gazeOutputFilterType);
Debug.Log("Gaze output filter type is now: " + VarjoEyeTracking.GetGazeOutputFilterType());

//Hiding the gazetarget if gaze is not available or if the gaze calibration is not done
if (VarjoEyeTracking.IsGazeAllowed() && VarjoEyeTracking.IsGazeCalibrated() && showGazeTarget)
Expand All @@ -167,25 +162,17 @@ private void Start()
void Update()
{
// start loggin when calibration is finished
if (VarjoEyeTracking.IsGazeAllowed() && VarjoEyeTracking.IsGazeCalibrated() && BeginLogging == true)
if (VarjoEyeTracking.IsGazeAllowed() && VarjoEyeTracking.IsGazeCalibrated() && LogAfterCalibration == true)
{
StartLogging();
BeginLogging = false;
LogAfterCalibration = false;
}

// Request gaze calibration
if (Input.GetKeyDown(calibrationRequestKey))
{
VarjoEyeTracking.RequestGazeCalibration(gazeCalibrationMode);
}

// Set output filter type
if (Input.GetKeyDown(setOutputFilterTypeKey))
{
VarjoEyeTracking.SetGazeOutputFilterType(gazeOutputFilterType);
Debug.Log("Gaze output filter type is now: " + VarjoEyeTracking.GetGazeOutputFilterType());
}

// Check if gaze is allowed
if (Input.GetKeyDown(checkGazeAllowed))
{
Expand Down

0 comments on commit 64e4a1e

Please sign in to comment.