search/
Start typing to search packages!
package_2
solar-system
By @dooougs
Roblox
Mirrored from WallySolarSystem
A real sun, moon and planets over any place on Earth, worked out from a shared UTC clock, for Roblox. Every server and client computes the same sky with nothing sent over the network. Optional client driver moves Roblox's own sun to match and eases the lighting through night, dawn, day and dusk.
Extracted from Plant World.
Install
[dependencies]
SolarSystem = "dooougs/solar-system@0.1.0"
Use
local SolarSystem = require(ReplicatedStorage.Packages.SolarSystem)
local sky = SolarSystem.new({
location = { lat = 55.95, lon = -3.19 }, -- or function() return lat, lon end
})
print(sky:phase(), sky:daylight(), sky:state().sunrise)
sky:onPhaseChanged(function(phase, state) print("now", phase) end)
-- client only
SolarSystem.Lighting.start(sky, { indoor = nil, updateEvery = 0.5 })
SolarSystem.new(options)
| option | default | |
|---|---|---|
location | required | {lat, lon} or function() -> lat, lon (lazy, may yield) |
clock | workspace:GetServerTimeNow | function() -> unix seconds |
offsetAttribute | "SolarHourOffset" | attribute with a test hour offset; false turns it off |
offsetHolder | ReplicatedStorage | instance holding that attribute |
dayAbove / nightBelow | 6 / -6 | sun heights (degrees) bounding day and night |
horizon | -0.833 | sunrise/sunset height |
watchInterval | 0.5 | seconds between phase checks |
phaseEvents | true | false and onPhaseChanged never fires |
SolarSystem.Lighting.start(sky, options) (client)
| option | default | |
|---|---|---|
placeSun | true | move Roblox's sun (ClockTime + GeographicLatitude) to the real sun |
blendLooks | true | blend Brightness, ambient, colour shift by sun height |
looks | DEFAULT_LOOKS | { {at = degrees, look = {...}} }, last is the day |
dayLookFromPlace | true | read the day look from the place's own Lighting |
dayLookDelay | 0 | seconds to wait before reading it |
atmosphere / colorCorrection / sunRays | true | which effects to tint |
updateEvery | 0.5 | seconds between updates |
indoor | nil | function() -> {inside, dark?, tint?, bright?} for indoor light |
connect | signal:Connect | function(signal, label, fn) to hook a frame budgeter |
Pure maths
SolarSystem.Astro (subsolar point, moon, sunAt(lat, lon, t)),
SolarSystem.Geo (lat/lon <-> globe vectors), SolarSystem.Planets.sky(t),
SolarSystem.MoonMap (Moon brightness tiles).
Package Details
Install command (Click to copy)
Version
0.1.0
License
MIT
Safe for commercial use
Automated license review — not legal advice.
