//============================================================== // 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; }
public GazeConvergenceData GetWorldGazeConvergence() { GazeConvergenceData localConvergence = GetGazeConvergence_Raw(); Ray localRay = localConvergence.ray; Vector3 rOrigin = localRay.origin + transform.position; Vector3 rDirect = transform .TransformDirection(new Vector3(localRay.direction.x, localRay.direction.y, localRay.direction.z)) .normalized; return(new GazeConvergenceData(new Ray(rOrigin, rDirect), localConvergence.distance, localConvergence.accuracy)); }