コード例 #1
0
        /// <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));
        }
コード例 #2
0
ファイル: SunPosition.cs プロジェクト: Chapmania/Juniper
        /// <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();
            }
        }
コード例 #3
0
 /// <summary>
 /// Converts an AltitudeAzimuth to Unity's standard rotation construct.
 /// </summary>
 public static Quaternion ToQuaternion(this HorizontalSphericalPosition p)
 {
     return(Quaternion.Euler(p.ToEuler()));
 }