Info
MLCelestialData inherits from [Component](/docs/create/lua/API/Component/index.html)
Lua interface for MLCelestialData component. MLCelestialData provides a machine independent UTC time and topocentric position of the sun and moon. If a directional light source is provided, it will rotate it based on the calculated sun position every frame.
| Name | Description |
|---|
MLCelestialData.LunarAltitude | The angle of the moon relative to the Earth’s horizon in degrees. |
MLCelestialData.LunarAzimuth | The moon’s horizontal angle with respect to north in degrees. |
MLCelestialData.LunarIlluminationFraction | The illuminated fraction of the moon’s disk. A value between 0 and 1. |
MLCelestialData.LunarPhase | The current phase of the moon is indicated by a value between 0 and 1. 0 or 1 indicates the new moon, 0.25 indicates the quarter moon, 0.5 half-moon. |
MLCelestialData.SunAltitude | The angle of the sun relative to the Earth's horizon in degrees. |
MLCelestialData.SunAzimuth | The sun’s horizontal angle with respect to north. Clockwise positive. For example, sun’s azimuth angle is 90 degrees during full eastern sunrise, until midway. |
MLCelestialData.SunMovementEnabled | Indicates if the movement of directional light (sun) by the component enabled. |
| Name | Description |
|---|
MLCelestialData.ApplyTimeOffset(offset) | Applies a time offset to current time in seconds. You can use this function to change time, speed up or slow down time and solar/lunar calculations. (no relation to system time, frame rate or any other time parameters) |
MLCelestialData.EnableSunMovement(enabled) | Enables or disables the movement of the directional light (sun) by the component. |
MLCelestialData.GetLocalTime() | Get current machine independent local time based on specified time zone (in seconds since epoch, similar format as os.time()). |
MLCelestialData.GetUTCTime() | Current local machine independent UTC time (in seconds since epoch, similar format with os.time). |
| Name | Description |
|---|
MLCelestialData.gameObject | The game object this component is attached to. A component is always attached to a game object. |
MLCelestialData.tag | The tag of this game object. |
MLCelestialData.transform | The Transform attached to this GameObject. |
MLCelestialData.hideFlags | Should the object be hidden, saved with the Scene or modifiable by the user? |
MLCelestialData.name | The name of the object. |