The sun position calculator “strange math” is acrually science.
The system supposedly (with very bad accuracy) positions the sun based on a julian date, so in theory you can set your lon/lat and get a screenshot of where the sun would have been at X point in time (past or future).
Considering what it is - the pss poor accuracy is just fine. The margin of error probably breaks down to the sun being a few deegrees off on that hour, which great scheme of things is not bad.
The system itself isnt really designed to do a day/night cycle - because operating these calcs at runtime is outright insane.
The error experienced above was probably some floating point issue with one of the calculations - even back when the engine we all set to float, some calcs would break down. Just the nature of computer math.
The issue gets compounded when you try to do things you should not (like run these complex calculations at runtime to get the directional light to move).
Instead,
Placing your sun/game project on the equator is always going to be the cheapest solution.
But for the 2c it costs you, go and learn what Right Ascention and Declination mean.
Learn how to calculate a position based on Lon/Lat.
Run the math once to get the approximate angle you need your sun to run at.
From then on, I suggest just turning it around to where you effectively only change one rotational value over time like you would for an equator setup. Leave the other angle be even if its inaccurate so long as it looks close to what you want.
Then apin the sun - but for a day cycle you need to habdle a lot more than just position and light intensity. The landscape or meshes will also need a light blocking box underneath to prevent Unreal from… well, being unreal.
It’s all smoke and mirrors and quite honestly, a flat earther’s wet dream by design. So you really jeed to learn the basics of whe things really work like, and have enough brain power to convert them into flat earth nonsense to get unreal to look good when using the built in systems (and light sources).
BTW - the latest engine kismet Modulus calculations give worse errors than prior versions because of their change to using Double (i think bad functions are at play, so they’ll eventually get patched) - but in 5.x you cannot rely on blueprint math do something that needs a modicum amount of precision like the day cycle.
Not sure where that leaves the BP only people.
Everyone else should really just implement a julian date calc function in c++, run it once or twice per day cycle to re-align stuff provided the CPU ms cost of the function is neglectible when the rest of your game is working.
Or just leave it there, use it on level start only…