Пример #1
0
        /// <summary>
        /// Returns the data that describes the convergence point of the eyes this frame. See the description of the
        /// `GazeConvergenceData` for more detail on how to use this information.
        /// </summary>
        /// <returns>A struct describing the gaze convergence in HMD-relative space.</returns>
        public GazeConvergenceData GetGazeConvergence_Raw()
        {
            CheckStaticConcurrency();
            SFVR_GazeConvergenceData convergence;

            _sHeadset.GetGazeConvergence(out convergence);
            return(new GazeConvergenceData(convergence.ray, convergence.distance, convergence.accuracy));
        }
Пример #2
0
        //==============================================================
        // RENDER-SYNCED ACCESS
        private void CheckStaticConcurrency()
        {
            // Skip this function if it's already been run this frame
            if (_sHasUpdatedStaticData)
            {
                return;
            }

            if (_isHmdConnected)
            {
                _sHeadPosition = new Vector3(_sLastPose.position.x, _sLastPose.position.y, _sLastPose.position.z);
                _sHeadRotation = new Quaternion(_sLastPose.orientation.x, _sLastPose.orientation.y, _sLastPose.orientation.z,
                                                _sLastPose.orientation.w);

                SFVR_GazeVector lGaze, rGaze;

                var errLeft  = _sHeadset.GetGazeVector(EFVR_Eye.Left, out lGaze);
                var errRight = _sHeadset.GetGazeVector(EFVR_Eye.Right, out rGaze);
                if (errLeft == EFVR_ErrorCode.None && errRight == EFVR_ErrorCode.None)
                {
                    _sEyeVecLeft  = new Vector3(lGaze.vector.x, lGaze.vector.y, lGaze.vector.z);
                    _sEyeVecRight = new Vector3(rGaze.vector.x, rGaze.vector.y, rGaze.vector.z);
                }
            }

            SFVR_GazeConvergenceData conv;
            var convErr = _sHeadset.GetGazeConvergence(out conv);

            _sGazeConvergence = new GazeConvergenceData(conv.ray, conv.distance);
            _sPupilDilation   = conv.pupilDilation;
            _sAttention       = conv.attention;

            _sHasUpdatedStaticData = true;
        }