Skip to main content

SunPositionUtils

Utility to position the sun and to retrieve sun information specific to Roblox.

Note this is not an accurate guess of where the sun would be on earth, but rather the computation to compute where Roblox is rendering the sun given the lighting properties set.

Functions

getGeographicalLatitudeFromDirection

SunPositionUtils.getGeographicalLatitudeFromDirection(directionVector3) → number

Gets the geographical latitude from a vector pointing at the sun.

getClockTimeFromDirection

SunPositionUtils.getClockTimeFromDirection(directionVector3) → number

Gets the clock time for the given direction.

getClockTimeFromMoonDirection

SunPositionUtils.getClockTimeFromMoonDirection(directionVector3) → number

Gets the clock time from the given moon direction.

getDirection

SunPositionUtils.getDirection(
azimuthRadnumber,
altitudeRadnumber,
northVector3?
) → number

Gets the direction the sun should be facing given the azimuth and altitude

getSunPosition

SunPositionUtils.getSunPosition(
clockTimenumber,
geoLatitudenumber
) → (
Vector3,--

Sun position

Vector3--

Moon position

)

Estimates the sun position given the clockTime and geographical latitude.

Show raw api
{
    "functions": [
        {
            "name": "getGeographicalLatitudeFromDirection",
            "desc": "Gets the geographical latitude from a vector pointing at the sun.",
            "params": [
                {
                    "name": "direction",
                    "desc": "",
                    "lua_type": "Vector3"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 22,
                "path": "src/sunpositionutils/src/Shared/SunPositionUtils.lua"
            }
        },
        {
            "name": "getClockTimeFromDirection",
            "desc": "Gets the clock time for the given direction.",
            "params": [
                {
                    "name": "direction",
                    "desc": "",
                    "lua_type": "Vector3"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 35,
                "path": "src/sunpositionutils/src/Shared/SunPositionUtils.lua"
            }
        },
        {
            "name": "getClockTimeFromMoonDirection",
            "desc": "Gets the clock time from the given moon direction.",
            "params": [
                {
                    "name": "direction",
                    "desc": "",
                    "lua_type": "Vector3"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 47,
                "path": "src/sunpositionutils/src/Shared/SunPositionUtils.lua"
            }
        },
        {
            "name": "getDirection",
            "desc": "Gets the direction the sun should be facing given the azimuth and altitude",
            "params": [
                {
                    "name": "azimuthRad",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "altitudeRad",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "north",
                    "desc": "",
                    "lua_type": "Vector3?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 61,
                "path": "src/sunpositionutils/src/Shared/SunPositionUtils.lua"
            }
        },
        {
            "name": "getSunPosition",
            "desc": "Estimates the sun position given the clockTime and geographical latitude.",
            "params": [
                {
                    "name": "clockTime",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "geoLatitude",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "Sun position",
                    "lua_type": "Vector3"
                },
                {
                    "desc": "Moon position",
                    "lua_type": "Vector3"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 74,
                "path": "src/sunpositionutils/src/Shared/SunPositionUtils.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "SunPositionUtils",
    "desc": "Utility to position the sun and to retrieve sun information specific to Roblox.\n\nNote this is not an accurate guess of where the sun would be on earth, but rather\nthe computation to compute where Roblox is rendering the sun given the lighting\nproperties set.",
    "source": {
        "line": 10,
        "path": "src/sunpositionutils/src/Shared/SunPositionUtils.lua"
    }
}