void Update() { var provider = EyetrackingProvider ?? TobiiXR.Provider; var gazeModifierFilter = TobiiXR.Internal.Filter as GazeModifierFilter; var eyeTrackingData = EyeTrackingDataHelper.Clone(provider.EyeTrackingData); if (ScaleAffectedByPrecision && gazeModifierFilter != null) { gazeModifierFilter.FilterAccuracyOnly(eyeTrackingData); } 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)); } }
public void Tick() { #if TOBIIXR_HTCPROVIDER _hmdToWorldTransformer.Tick(); EnsureHTCFrameworkRunning(); if (SRanipal_Eye_Framework.Status != SRanipal_Eye_Framework.FrameworkStatus.WORKING) { return; } EyeTrackingData.Timestamp = Time.unscaledTime; EyeTrackingData.GazeRay.IsValid = SRanipal_Eye.GetGazeRay(GazeIndex.COMBINE, out EyeTrackingData.GazeRay.Origin, out EyeTrackingData.GazeRay.Direction); // Blink float eyeOpenness = 0; var eyeOpennessIsValid = SRanipal_Eye.GetEyeOpenness(EyeIndex.LEFT, out eyeOpenness); EyeTrackingData.IsLeftEyeBlinking = !eyeOpennessIsValid || eyeOpenness < 0.1; eyeOpennessIsValid = SRanipal_Eye.GetEyeOpenness(EyeIndex.RIGHT, out eyeOpenness); EyeTrackingData.IsRightEyeBlinking = !eyeOpennessIsValid || eyeOpenness < 0.1; // Convergence distance Vector3 leftRayOrigin, rightRayOrigin, leftRayDirection, rightRayDirection; var leftRayValid = SRanipal_Eye.GetGazeRay(GazeIndex.LEFT, out leftRayOrigin, out leftRayDirection); var rightRayValid = SRanipal_Eye.GetGazeRay(GazeIndex.RIGHT, out rightRayOrigin, out rightRayDirection); if (leftRayValid && rightRayValid) { EyeTrackingData.ConvergenceDistanceIsValid = true; var convergenceDistance_mm = Convergence.CalculateDistance( leftRayOrigin * 1000f, leftRayDirection, rightRayOrigin * 1000f, rightRayDirection ); EyeTrackingData.ConvergenceDistance = convergenceDistance_mm / 1000f; // Convert to meters } else { EyeTrackingData.ConvergenceDistanceIsValid = false; } // Transform to world space _localToWorldMatrix = _hmdToWorldTransformer.GetLocalToWorldMatrix(); EyeTrackingDataHelper.TransformGazeData(EyeTrackingData, _localToWorldMatrix); #endif }
public void GetEyeTrackingDataLocal(TobiiXR_EyeTrackingData data) { EyeTrackingDataHelper.Copy(_eyeTrackingDataLocal, data); }