/// <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_Immediate() { GazeConvergenceData localConvergence = FoveManager.GetLocalGazeConvergence_Immediate(); var localRay = localConvergence.ray; return(new GazeConvergenceData(TransformLocalRay(localRay), localConvergence.distance)); }
private void UpdateGaze(GazeConvergenceData conv, Vector3 vecLeft, Vector3 vecRight) { if (gaze) { _eyeConverge.distance = conv.distance; _eyeConverge.ray = TransformLocalRay(conv.ray); _eyeConverge.ray.direction.Normalize(); } else { var r = new UnityRay(Vector3.zero, Vector3.forward); _eyeConverge.ray = TransformLocalRay(r); } CalculateGazeRays(out _eyeRayLeft, out _eyeRayRight, vecLeft, vecRight); }
private static void UpdateHmdData() { _sLastPose = GetLastPose(); m_sHeadPosition = Utils.GetUnityVector(_sLastPose.position) * m_worldScale; m_sStandingPosition = Utils.GetUnityVector(_sLastPose.standingPosition) * m_worldScale; m_sHeadRotation = new UnityQuaternion(_sLastPose.orientation.x, _sLastPose.orientation.y, _sLastPose.orientation.z, _sLastPose.orientation.w); { GazeVector lGaze, rGaze; Fove.GazeConvergenceData conv; var errVector = Instance.m_headset.GetGazeVectors(out lGaze, out rGaze); var errConv = Instance.m_headset.GetGazeConvergence(out conv); if (errVector == ErrorCode.None && errConv == ErrorCode.None) { m_sEyeVecLeft = new Vector3(lGaze.vector.x, lGaze.vector.y, lGaze.vector.z); m_sEyeVecRight = new Vector3(rGaze.vector.x, rGaze.vector.y, rGaze.vector.z); m_sConvergenceData = new GazeConvergenceData(conv.ray, conv.distance); m_sPupilDilation = conv.pupilDilation; m_sGazeFixated = conv.attention; } } Matrix44 lEyeMx, rEyeMx; Instance.m_headset.GetEyeToHeadMatrices(out lEyeMx, out rEyeMx); { float lIOD = lEyeMx.m03; float lEyeHeight = lEyeMx.m13; float lEyeForward = lEyeMx.m23; m_sLeftEyeOffset = new Vector3(lIOD, lEyeHeight, lEyeForward) * m_worldScale; } { float rIOD = rEyeMx.m03; float rEyeHeight = rEyeMx.m13; float rEyeForward = rEyeMx.m23; m_sRightEyeOffset = new Vector3(rIOD, rEyeHeight, rEyeForward) * m_worldScale; } if (AddInUpdate != null) { AddInUpdate(); } }
virtual protected void UpdateGaze(GazeConvergenceData conv, Vector3 vecLeft, Vector3 vecRight) { // converge data var localConvDist = 0f; var localConvRay = new Ray(Vector3.zero, Vector3.forward); if (fetchGaze) { localConvRay = conv.ray; localConvDist = conv.distance; } _eyeConverge = GetWorldSpaceConvergence(ref localConvRay, localConvDist); // eye rays var usedDirLeft = fetchGaze ? vecLeft : Vector3.forward; var usedDirRight = fetchGaze ? vecRight : Vector3.forward; CalculateGazeRays(ref _stereoData[0].position, ref _stereoData[1].position, ref usedDirLeft, ref usedDirRight, out _eyeRayLeft, out _eyeRayRight); }