How can I switch the sun's setting point ingame? Explanation in post

So I have a strange predicament where my sun is setting in the east rather than the west. This is problematic, considering my game is the entire United States. Sun shouldn’t exactly be setting in the East.

I’ve tried changing a day/night cycle to go backwards but all it did was make the clock go negative. I can only imagine that this would cause problems somehow ingame.

Is it possible to use GeographicalLatitude properly without guessing to fix this? Otherwise, I have genuinely no idea how to change this.

And before someone says ‘just restart’, I’m a year into the project so there’s no turning back.

1 Like

The simplest fix I can think of is just rotating the entire Workspace 180 degrees.

The clock in Lighting affects nothing, it is visual only. If there are any actual in-game clocks or watches that show the time in Lighting, then they can simply be adjusted to also go backwards (backward backwards is forward)

Is it possible to use GeographicalLatitude properly without guessing to fix this? Otherwise, I have genuinely no idea how to change this.

It isn’t, GeographicalLatitude is exactly what it says on the tin. Be you are in Antarctica or Africa or America, the sun will still rise from the east and set to the west.

for i, v in ipairs(game:GetService("Workspace"):GetChildren()) do
   if v:IsA("BasePart") then
     v.Orientation = v.Orientation + Vector3.new(0, 180, 0)
   end
end

-- may or may not work

Bump, I’ve accidentally done the same thing. I have water (terrain) though so I’m not sure how to rotate that too? Unless there is another method?

Hold on, I never noticed this little detail three years ago. I just wrote a day/night cycle script and it had no issues whatsoever.
Maybe your script was really old and used TimeOfDay.

--!strict
local Lighting = game:GetService("Lighting")::Lighting

local hoursPerSecond = -0.1

while true do
	-- The wait() is so long so that clueless users of this code do not shoot
	-- themselves in the foot with pointless 60fps network traffic.
	-- A server script should send the current DistributedGameTime to clients
	-- exactly once and let them set time of day independently based on that.
	local dt = task.wait(2.5)
	Lighting.ClockTime = (Lighting.ClockTime + dt * hoursPerSecond) % 24
end

hoursPerSecond here can be negative or positive, doesn’t matter.
I guess the only possible problem here is if there’s a clock of some sort showing in-game time that’s going to run backwards. You’ll have to figure out the current time yourself.

Another way to go about this is to use the Celestial Body Dragger’s code to move the sun instead of ClockTime. This isn’t recommended if you want the sun to move north to south or something because twilight and moon movement break down at the pole.

The easy way to rotate the workspace 180° now is to set the Pivot Offset to 0,0,0 orientation, then set Origin.Orientation.Y to 180, all in the Properties panel.

Terrain is a lot more complicated. Unless there’s a method to rotate or flip pieces of terrain, you will have to swap every terrain cell on one half of the map with the cell on the other half (flipping both axes, i.e. negating both signs, is equivalent to a 180° rotation).

1 Like