Real stars
Usage
local starcreator = require(script.Parent.Star)
local database = require(script.Parent.Star.BStr1000)
starcreator.LoadArr(database,workspace.Part)
local latitude = 6.63880 --Set latitude
local longtitude = 100.42340 --Set longtitude
local ttz
while task.wait() do
ttz=DateTime.now():ToUniversalTime() --Set time to UTC
year,month,day,hour,minute,second=ttz.Year,ttz.Month,ttz.Day,ttz.Hour,ttz.Minute,ttz.Second--Expand the time
year,month,day,hour,minute,second=tonumber(year),tonumber(month),tonumber(day),tonumber(hour),tonumber(minute),tonumber(second)--Deprecated, Used for os.time applications
starcreator.LoadRot(latitude,90+starcreator.calculateLST(longtitude,year,month,day,hour,minute,second)*15+,workspace.Part)--Rotate workspace.part,
end
This code will create a realistic sky at Sadao, Thailand at any time according to UNIX timestamp
Documentation
A few function you need to use
starcreator.LoadArr(database : Array , Part : Part)
- Loads stars from a Database array, around a part as attachment at 2000 studs
starcreator.calculateLST(longtitude : degree , year : Number , month : Number , day : Number , hour : Number , minute : Number , second : Number)
-
Calculates the Local Sidereal Time from longtitude and time precisely
-
Returns Local Sidereal Time in Decimal Hour
starcreator.LoadRot(latitude : degree , 90 + LST : degree , Part : Part)
- Rotate a part to the appropriate rotation given latitude and LST
- The 90 Degree is to account for initial rotation of the part that has original rotation as 0,0,0 when loadArr is called on the part
Limitations
-
It is accurate but in no way should be used for real world stuff like navigation
-
Verified by checking with Stellarium Which might be incorrect
-
Might not be correct as I am not sure wheture EOT is accounted for in the LST calculations
-
The daytime and Sun is not included right now, So no sun, No daylight and No Moon
-
No fog or atmosphere at all
-
Stars always visible ( Might fix in da future)
Expanding
Check this Github page, This is the code used to create the JSON data string to be used in Real Stars
License
Get it
- Module Scirpt
- Place File (114.2 KB)
Notes
- Only top 1000 brightest (Apparent Magnitude) stars are added