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();
        }
    }
示例#2
0
        void Update()
        {
            if (Time.frameCount == _lastUpdatedFrame)
            {
                return;
            }

            _lastUpdatedFrame = Time.frameCount;

            TrackWindow();

            var gameViewBounds = _gameViewBoundsProvider.GetGameViewClientAreaNormalizedBounds();

            _gameViewInfo = new GameViewInfo(gameViewBounds);

            TobiiGameIntegrationApi.Update();

            _gazeFocus.UpdateGazeFocus();
        }