/// <summary>
        /// Converts an AltitudeAzimuth to Unity's standard Euler rotation construct.
        /// </summary>
        public static Vector3 ToEuler(this HorizontalSphericalPosition p)
        {
            if (p is null)
            {
                throw new System.ArgumentNullException(nameof(p));
            }

            return(new Vector3(p.AltitudeDegrees, p.AzimuthDegrees, 0));
        }
Esempio n. 2
0
        /// <summary>
        /// Retrieves the current <see cref="location"/> and/or <see cref="compass"/>, if they are
        /// needed, updates the <see cref="currentTime"/>, calculates the correct sun position from
        /// that time, and optionally prints a debug report.
        /// </summary>
        public void Update()
        {
            currentTime = GetTime();

            if (location.Coord != lastCoord)
            {
                lastCoord   = location.Coord;
                orientation = location.Coord.ToSunPosition(currentTime);
            }

            if (DebugReport)
            {
                PrintDebugReport();
            }
        }
 /// <summary>
 /// Converts an AltitudeAzimuth to Unity's standard rotation construct.
 /// </summary>
 public static Quaternion ToQuaternion(this HorizontalSphericalPosition p)
 {
     return(Quaternion.Euler(p.ToEuler()));
 }