Skip to content

API > MLCelestialData


MLCelestialData⚓︎

MLCelestialData inherits from Component

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.

Members⚓︎

Properties⚓︎

Name Description
MLCelestialData.LunarAltitudePropertyReadonly Property The angle of the moon relative to the Earth’s horizon in degrees.
MLCelestialData.LunarAzimuthPropertyReadonly Property The moon’s horizontal angle with respect to north in degrees.
MLCelestialData.LunarIlluminationFractionPropertyReadonly Property The illuminated fraction of the moon’s disk. A value between 0 and 1.
MLCelestialData.LunarPhasePropertyReadonly Property 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.SunAltitudePropertyReadonly Property The angle of the sun relative to the Earth's horizon in degrees.
MLCelestialData.SunAzimuthPropertyReadonly Property 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.SunMovementEnabledPropertyReadonly Property Indicates if the movement of directional light (sun) by the component enabled.

Methods⚓︎

Name Description
MLCelestialData.ApplyTimeOffset(offset) Method 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) Method Enables or disables the movement of the directional light (sun) by the component.
MLCelestialData.GetLocalTime() Method Get current machine independent local time based on specified time zone (in seconds since epoch, similar format as os.time()).
MLCelestialData.GetUTCTime() Method Current local machine independent UTC time (in seconds since epoch, similar format with os.time).

Inherited Members⚓︎

Inherited Properties⚓︎

Name Description
MLCelestialData.gameObjectPropertyReadonly Property The game object this component is attached to. A component is always attached to a game object.
MLCelestialData.tagPropertyReadonly Property The tag of this game object.
MLCelestialData.transformPropertyReadonly Property The Transform attached to this GameObject.
MLCelestialData.hideFlagsProperty Should the object be hidden, saved with the Scene or modifiable by the user?
MLCelestialData.nameProperty The name of the object.

Inherited Methods⚓︎

Name Description
MLCelestialData.BroadcastMessage(methodName, parameter=nil)Method Calls the method named methodName on every Lua Script in this game object or any of its children.
MLCelestialData.CompareTag(tag)Method Is this game object tagged with tag ?
MLCelestialData.GetAllLuaScripts()Method Returns an array of all Lua scripts that attached to the game object.
MLCelestialData.GetComponent(type)Method Returns the component of Type type if the game object has one attached, nil if it doesn't.
MLCelestialData.GetComponentInChildren(t)Method Returns the component of Type type in the GameObject or any of its children using depth first search.
MLCelestialData.GetComponentInParent(t)Method Returns the component of Type type in the GameObject or any of its parents.
MLCelestialData.GetComponents(type)Method Returns all components of Type type in the GameObject.
MLCelestialData.GetComponentsInChildren(t)Method Returns all components of Type type in the GameObject or any of its children.
MLCelestialData.GetComponentsInParent(t)Method Returns all components of Type type in the GameObject or any of its parents.
MLCelestialData.SendMessage(methodName, value=nil)Method Calls the method named methodName on every Lua Script in this game object.
MLCelestialData.SendMessageUpwards(methodName, value=nil)Method Calls the method named methodName on every LuaScript in this game object and on every ancestor of the behaviour.
MLCelestialData.TryGetComponent(type)Method Gets the component of the specified type, if it exists.
MLCelestialData.GetInstanceID()Method Returns the instance id of the object.