Beispiel #1
0
        /// <summary>
        /// When <see cref="DebugReport"/> is set to true, the <see cref="Update"/> function calls
        /// this function at its end.
        /// </summary>
        private void PrintDebugReport()
        {
            try
            {
                if (!CanSeeHorizon)
                {
                    ScreenDebugger.Print("Can't see the horizon");
                }

                if (IsUpsideDown)
                {
                    ScreenDebugger.Print("Device is upside down");
                }

                if (!HasHeading)
                {
                    ScreenDebugger.Print("No heading available yet");
                }

                if (camT == null)
                {
                    ScreenDebugger.Print("  Please set the MainCamera tag on a camera in the scene");
                }
                else if (UseFakeHeading)
                {
                    ScreenDebugger.Print("  Using a static heading");
                }
                else if (!UnityInput.compass.enabled)
                {
                    ScreenDebugger.Print("  Compass not available");
                }
                else
                {
                    var deltaHeading   = CompassHeading - CameraHeading;
                    var sampleProgress = samples.Count / (float)averagingIterations;
                    ScreenDebugger.Print($"  Raw Magnetometer {CompassHeading.Label(UnitOfMeasure.Degrees, 4)}");
                    ScreenDebugger.Print($"  Camera Angle {CameraHeading.Label(UnitOfMeasure.Degrees, 4)}");
                    ScreenDebugger.Print($"  Delta {deltaHeading.Label(UnitOfMeasure.Degrees, 4)}");
                    ScreenDebugger.Print($"  To North {toNorthHeading.Label(UnitOfMeasure.Degrees, 4)}");
                    ScreenDebugger.Print($"  North {toNorthHeading.Label(UnitOfMeasure.Degrees, 4)} ({samples.Count}/{averagingIterations}: {sampleProgress.Label(UnitOfMeasure.Proportion)}, σ = {samples.StandardDeviation})");
                }
            }
            catch (Exception exp)
            {
                ScreenDebugger.PrintException(exp, "CompassRose");
            }
        }