diff --git a/unity_pupil_plugin_vr/Assets/Market Scene Demo/Scripts/MarketWith2DCalibration.cs b/unity_pupil_plugin_vr/Assets/Market Scene Demo/Scripts/MarketWith2DCalibration.cs index e6e44440..a166c4ac 100644 --- a/unity_pupil_plugin_vr/Assets/Market Scene Demo/Scripts/MarketWith2DCalibration.cs +++ b/unity_pupil_plugin_vr/Assets/Market Scene Demo/Scripts/MarketWith2DCalibration.cs @@ -18,7 +18,7 @@ public class MarketWith2DCalibration : MonoBehaviour void Start () { - PupilData.calculateMovingAverage = true; + PupilData.calculateMovingAverage = false; sceneCamera = gameObject.GetComponent (); calibrationDemo = gameObject.GetComponent (); diff --git a/unity_pupil_plugin_vr/Assets/pupil_plugin/Scripts/Networking/PupilData.cs b/unity_pupil_plugin_vr/Assets/pupil_plugin/Scripts/Networking/PupilData.cs index eb01ef8b..2863ee1c 100644 --- a/unity_pupil_plugin_vr/Assets/pupil_plugin/Scripts/Networking/PupilData.cs +++ b/unity_pupil_plugin_vr/Assets/pupil_plugin/Scripts/Networking/PupilData.cs @@ -149,20 +149,44 @@ public static Vector3 GazePosition public static Vector3 LeftEyeCenter { - get { return leftEyeCenter.Average3D; } + get + { + if (calculateMovingAverage) + return leftEyeCenter.Average3D; + else + return leftEyeCenter.Raw3D; + } } public static Vector3 RightEyeCenter { - get { return rightEyeCenter.Average3D; } + get + { + if (calculateMovingAverage) + return rightEyeCenter.Average3D; + else + return rightEyeCenter.Raw3D; + } } public static Vector3 LeftGazeNormal { - get { return leftGazeNormal.Average3D; } + get + { + if (calculateMovingAverage) + return leftGazeNormal.Average3D; + else + return leftGazeNormal.Raw3D; + } } public static Vector3 RightGazeNormal { - get { return rightGazeNormal.Average3D; } + get + { + if (calculateMovingAverage) + return rightGazeNormal.Average3D; + else + return rightGazeNormal.Raw3D; + } } public static class Circle @@ -194,12 +218,26 @@ public class _2D { private static Vector2 LeftEyePos { - get{ return leftEye.Average2D; } + get + { + if (calculateMovingAverage) + return leftEye.Average2D; + else + return leftEye.Raw2D; + + } } private static Vector2 RightEyePos { - get{ return rightEye.Average2D; } + get + { + if (calculateMovingAverage) + return rightEye.Average2D; + else + return rightEye.Raw2D; + + } } private static Vector2 GazePosition diff --git a/unity_pupil_plugin_vr/Assets/pupil_plugin/Scripts/Pupil/EyeData.cs b/unity_pupil_plugin_vr/Assets/pupil_plugin/Scripts/Pupil/EyeData.cs index 3643002a..19d740cb 100644 --- a/unity_pupil_plugin_vr/Assets/pupil_plugin/Scripts/Pupil/EyeData.cs +++ b/unity_pupil_plugin_vr/Assets/pupil_plugin/Scripts/Pupil/EyeData.cs @@ -71,7 +71,7 @@ public Vector2 Average2D { get { - if (data.Length != 2) + if (data == null || data.Length != 2) return Vector2.zero; _average2D.x = data [0].Value; _average2D.y = data [1].Value; @@ -83,7 +83,7 @@ public Vector3 Average3D { get { - if (data.Length != 3) + if (data == null || data.Length != 3) return Vector3.zero; _average3D.x = data [0].Value; _average3D.y = -data [1].Value; @@ -96,7 +96,7 @@ public Vector2 Raw2D { get { - if (raw.Length != 2) + if (raw == null || raw.Length != 2) return Vector2.zero; _raw2D.x = raw [0]; _raw2D.y = raw [1]; @@ -108,7 +108,7 @@ public Vector3 Raw3D { get { - if (raw.Length != 3) + if (raw == null || raw.Length != 3) return Vector3.zero; _raw3D.x = raw [0]; _raw3D.y = -raw [1]; diff --git a/unity_pupil_plugin_vr/Assets/pupil_plugin/Scripts/Pupil/PupilGazeTracker.cs b/unity_pupil_plugin_vr/Assets/pupil_plugin/Scripts/Pupil/PupilGazeTracker.cs index 0eaf1c5f..5525507f 100644 --- a/unity_pupil_plugin_vr/Assets/pupil_plugin/Scripts/Pupil/PupilGazeTracker.cs +++ b/unity_pupil_plugin_vr/Assets/pupil_plugin/Scripts/Pupil/PupilGazeTracker.cs @@ -239,7 +239,7 @@ void Start () if (PupilGazeTracker._Instance == null) PupilGazeTracker._Instance = this; - PupilData.calculateMovingAverage = true; + PupilData.calculateMovingAverage = false; //make sure that if the toggles are on it functions as the toggle requires it if (isOperatorMonitor && OnOperatorMonitor == null)