public void Update() { TobiiGameIntegrationApi.Update(); { var gazePoints = TobiiGameIntegrationApi.GetGazePoints(); if (gazePoints.Count > 0) { GazeX = (Math.Min(Math.Max(gazePoints.Last().X, -1.0f), 1.0f)); GazeY = -(Math.Min(Math.Max(gazePoints.Last().Y, -1.0f), 1.0f)); } var headPoses = TobiiGameIntegrationApi.GetHeadPoses(); if (headPoses.Count > 0) { Yaw = -headPoses.Last().Rotation.Yaw; Pitch = headPoses.Last().Rotation.Pitch; Roll = headPoses.Last().Rotation.Roll; X = headPoses.Last().Position.X; Y = headPoses.Last().Position.Y; Z = headPoses.Last().Position.Z; TimeStampMicroSeconds = headPoses.Last().TimeStampMicroSeconds; } } _frame++; if (_frame > 60) { _frame = 0; AspectRatio = GetDisplayAspectratio(); } }
protected override void UpdateAllChangedExtendedViewSettings() { if (!ExtendedViewSettingsForInspector.ShouldDeepEqual(GazeOnlySettings, _lastGazeOnlySettings)) { TobiiGameIntegrationApi.UpdateExtendedViewGazeOnlySettings(GazeOnlySettings.ToExtendedViewSettings()); _lastGazeOnlySettings = new ExtendedViewSettingsForInspector(GazeOnlySettings.ToExtendedViewSettings()); if (GazeOnlySettingsUiEventsManager != null) { GazeOnlySettingsUiEventsManager.FillUiWithCurrentSettings(); } } if (!ExtendedViewSettingsForInspector.ShouldDeepEqual(HeadOnlySettings, _lastHeadOnlySettings)) { TobiiGameIntegrationApi.UpdateExtendedViewHeadOnlySettings(HeadOnlySettings.ToExtendedViewSettings()); _lastHeadOnlySettings = new ExtendedViewSettingsForInspector(HeadOnlySettings.ToExtendedViewSettings()); if (HeadOnlySettingsUiEventsManager != null) { HeadOnlySettingsUiEventsManager.FillUiWithCurrentSettings(); } } if (!ExtendedViewSettingsForInspector.ShouldDeepEqual(HeadAndGazeSettings, _lastHeadAndGazeSettings)) { TobiiGameIntegrationApi.UpdateExtendedViewSettings(HeadAndGazeSettings.ToExtendedViewSettings()); _lastHeadAndGazeSettings = new ExtendedViewSettingsForInspector(HeadAndGazeSettings.ToExtendedViewSettings()); if (HeadAndGazeSettingsUiEventsManager != null) { HeadAndGazeSettingsUiEventsManager.FillUiWithCurrentSettings(); } } }
private void TrackWindow() { if (_gameViewBoundsProvider.Hwnd != IntPtr.Zero) { TobiiGameIntegrationApi.TrackWindow(_gameViewBoundsProvider.Hwnd); IsInitialized = true; } }
protected override void UpdateData() { var gazePoints = TobiiGameIntegrationApi.GetGazePoints(); foreach (var gazePoint in gazePoints) { OnGazePoint(gazePoint); } }
protected override void UpdateData() { var headPoses = TobiiGameIntegrationApi.GetHeadPoses(); foreach (var headPose in headPoses) { OnHeadPose(headPose); } }
public EyeTrackingHost() { _instance = this; Debug.Log("TobiiGameIntegrationApi.TrackWindow() before"); TobiiGameIntegrationApi.TrackWindow(Process.GetCurrentProcess().MainWindowHandle); Debug.Log("TobiiGameIntegrationApi.TrackWindow() after"); AspectRatio = 16f / 9f; }
public void Shutdown() { _isShuttingDown = true; if (IsInitialized) { #if !UNITY_EDITOR TobiiGameIntegrationApi.Shutdown(); #endif IsInitialized = false; } }
protected virtual void LateUpdate() { _extendedViewTransformation = TobiiGameIntegrationApi.GetExtendedViewTransformation(); UpdateSettings(); SendUpdatedSettingsToTgi(); UpdateExtendedViewAngles(); UpdateTransform(); #if UNITY_EDITOR UpdateAllChangedExtendedViewSettings(); #endif }
void Update() { if (Time.frameCount == _lastUpdatedFrame) { return; } _lastUpdatedFrame = Time.frameCount; TrackWindow(); var gameViewBounds = _gameViewBoundsProvider.GetGameViewClientAreaNormalizedBounds(); _gameViewInfo = new GameViewInfo(gameViewBounds); TobiiGameIntegrationApi.Update(); _gazeFocus.UpdateGazeFocus(); }
public void UpdateAllExtendedViewSettings() { TobiiGameIntegrationApi.UpdateExtendedViewGazeOnlySettings(GazeOnlySettings.ToExtendedViewSettings()); TobiiGameIntegrationApi.UpdateExtendedViewHeadOnlySettings(HeadOnlySettings.ToExtendedViewSettings()); TobiiGameIntegrationApi.UpdateExtendedViewSettings(HeadAndGazeSettings.ToExtendedViewSettings()); }
public void Dispose() { Debug.Log("TobiiGameIntegrationApi.StopTracking() before"); TobiiGameIntegrationApi.StopTracking(); Debug.Log("TobiiGameIntegrationApi.StopTracking() after"); }