Exemplo n.º 1
0
        private void Update()
        {
            var provider           = TobiiXR.Internal.Provider;
            var eyeTrackingData    = EyeTrackingDataHelper.Clone(provider.EyeTrackingDataLocal);
            var localToWorldMatrix = provider.LocalToWorldMatrix;
            var worldForward       = localToWorldMatrix.MultiplyVector(Vector3.forward);

            EyeTrackingDataHelper.TransformGazeData(eyeTrackingData, localToWorldMatrix);
            var gazeModifierFilter = TobiiXR.Internal.Filter as GazeModifierFilter;

            if (gazeModifierFilter != null)
            {
                gazeModifierFilter.FilterAccuracyOnly(eyeTrackingData, worldForward);
            }

            var gazeRay = eyeTrackingData.GazeRay;

            _spriteRenderer.enabled = gazeRay.IsValid;
            if (_spriteRenderer.enabled == false)
            {
                return;
            }

            SetPositionAndScale(gazeRay);

            if (ScaleAffectedByPrecision && gazeModifierFilter != null)
            {
                UpdatePrecisionScale(gazeModifierFilter.GetMaxPrecisionAngleDegrees(eyeTrackingData.GazeRay.Direction, worldForward));
            }
        }
Exemplo n.º 2
0
        private static void Tick()
        {
            Internal.Provider.Tick();
            EyeTrackingDataHelper.Copy(Internal.Provider.EyeTrackingDataLocal, _eyeTrackingDataLocal);
            EyeTrackingDataHelper.TransformGazeData(Internal.Provider.EyeTrackingDataLocal, _eyeTrackingDataWorld, Internal.Provider.LocalToWorldMatrix);

            if (Internal.Filter != null && Internal.Filter.enabled)
            {
                var worldForward = Internal.Provider.LocalToWorldMatrix.MultiplyVector(Vector3.forward);
                Internal.Filter.Filter(_eyeTrackingDataLocal, Vector3.forward);
                Internal.Filter.Filter(_eyeTrackingDataWorld, worldForward);
            }
            var g2omData = CreateG2OMData(_eyeTrackingDataWorld);

            Internal.G2OM.Tick(g2omData);
        }
Exemplo n.º 3
0
        public void Tick()
        {
            _streamEngineTracker.Tick();
            _hmdToWorldTransformer.Tick();

            var data = _streamEngineTracker.LocalLatestData;

            _eyeTrackingData.Timestamp                  = Time.unscaledTime;
            _eyeTrackingData.GazeRay                    = data.GazeRay;
            _eyeTrackingData.IsLeftEyeBlinking          = data.IsLeftEyeBlinking;
            _eyeTrackingData.IsRightEyeBlinking         = data.IsRightEyeBlinking;
            _eyeTrackingData.ConvergenceDistance        = data.ConvergenceDistance;
            _eyeTrackingData.ConvergenceDistanceIsValid = data.ConvergenceDistanceIsValid;

            _localToWorldMatrix = _hmdToWorldTransformer.GetLocalToWorldMatrix();
            EyeTrackingDataHelper.TransformGazeData(_eyeTrackingData, _localToWorldMatrix);
        }