Example #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 world space.</returns>
        public GazeConvergenceData GetGazeConvergence()
        {
            CheckStaticConcurrency();
            SFVR_GazeConvergenceData convergence;

            _sHeadset.GetGazeConvergence(out convergence);

            Vector3 origin    = FoveUnityUtils.GetUnityVector(convergence.ray.origin) + transform.position;
            Vector3 direction = transform.TransformDirection(FoveUnityUtils.GetUnityVector(convergence.ray.direction));
            Ray     worldRay  = new Ray(origin, direction);

            return(new GazeConvergenceData(worldRay, convergence.distance, convergence.accuracy));
        }