Skip to content

Astronomical System

AstronomicalSystem calculates solar state from the context's time, date, observer location, and AstronomicalProfile. It supplies simulation data; a separate presentation controller turns that data into a visible Sun or directional light.

Setup

  1. Enable Time, Calendar, and Astronomical System in the same context and ensure Calendar is initialized.
  2. Create or duplicate an Astronomical Profile and assign it to the system.
  3. Set Latitude, Longitude, and, only if needed, the optional solar-time correction controls.
  4. Inspect calculated solar elevation, azimuth, sunrise/sunset availability, and polar state at several dates/times. Check the coordinate convention before attaching your own objects.

Latitude is −90° south to +90° north; longitude is −180° west to +180° east. Directions use world X=East, Y=Up, Z=North. Solar elevation is measured above the horizon; azimuth and angular profile values are degrees, not radians.

Annual profile models

Calculation Model chooses authored seasonal events or a Keplerian orbit. The default authored model places equinoxes/solstices at normalized year positions; axial tilt controls declination amplitude. The component profile default tilt is 23.44°. Authored seasonal-event positions are fractions, not calendar day numbers.

The Keplerian model uses orbital eccentricity (0–0.99), perihelion solar longitude, and year-start solar longitude. It assumes one orbit per normalized calendar year. It is not a date/epoch-aware ephemeris: a Mars preset is a configurable model, not a promise of observatory-precision planetary predictions. Align year-start longitude with the calendar you actually use.

Clock time versus solar time

Longitude correction is off by default. Without it, the clock directly represents local solar time. Enabling it adds (longitude − timeZoneMeridian) / 360 to the day fraction. The reference meridian is not automatically connected to Time System's UTC offset. Setting an offset and assuming the Sun shifts automatically is a common configuration error.

Use SetLatitude, SetLongitude, and SetTimeZoneMeridian for runtime observer changes; verify the signature in API reference. Changing location affects dependent phases, seasons, lunar positioning, and presentation after their refresh/evaluation cycle.

Consume state safely

Read SolarDirection, SolarElevation, SolarAzimuth, SolarOrbitalLongitude, IsDaylight, IsPolarDay, and IsPolarNight through the bound context. Check sunrise/sunset availability rather than assuming every day has both horizon crossings. The system defers event-requested evaluation to LateUpdate so clock/calendar inputs can settle.

onAstronomicalStateUpdated has no payload; read the current properties when it fires. Solar exposure and daily energy factors are geometric proxies. DailyMeanSolarEnergyFactor is dimensionless, not irradiance, air temperature, or a weather simulation.

If the system is unavailable, check the profile and enabled Calendar/Time dependencies first. If its direction looks correct but lighting does not, diagnose presentation binding, not the solar model.

Related: Calendar, Day Phases, Lunar.