public void Update(ARFaceAnchor anchor) { if (!anchor.IsTracked || !RecordingEnabled || ScreenPPI == 0) { return; } // Render eye rays eyeRNode.Transform = anchor.RightEyeTransform.ToSCNMatrix4(); eyeLNode.Transform = anchor.LeftEyeTransform.ToSCNMatrix4(); // Perform Hit test using the ray segments that are drawn by the center of the eyeballs // to somewhere two meters away at direction of where users look at to the virtual plane that place // at the same orientation of the phone screen var phoneScreenEyeRHitTestResults = virtualPhoneNode.HitTest(lookAtTargetEyeRNode.WorldPosition, eyeRNode.WorldPosition, hitTestOptions); // HitTest with segment (virtualPhoneNode) var phoneScreenEyeLHitTestResults = virtualPhoneNode.HitTest(lookAtTargetEyeLNode.WorldPosition, eyeLNode.WorldPosition, hitTestOptions); if (phoneScreenEyeLHitTestResults.Length > 0 && phoneScreenEyeRHitTestResults.Length > 0) { CGPoint coordinates = ScreenPositionFromHittest(phoneScreenEyeLHitTestResults[0], phoneScreenEyeRHitTestResults[0]); // Update indicator position ? - SceneView.Superview.Frame.Width DispatchQueue.MainQueue.DispatchAsync(() => { //eyePositionIndicatorView.Center = coordinates; eyePositionIndicatorView.Transform = CGAffineTransform.MakeTranslation( coordinates.X, coordinates.Y ); //var distanceInCm = CalculateDistanceFromCamera(); }); // Calc eye screen position //int screenX = (int)(coordinates.X * screenScale); //int screenY = (int)(coordinates.Y * screenScale); //System.Diagnostics.Debug.WriteLine($"Screen X: {screenX} - Y: {screenY}"); // Send sensor data //MessagingCenter.Send<object, EyeGazeData>(this, "EyeSensorReading", // new EyeGazeData(DateTime.Now, screenX, screenY, distanceInCm)); } }