So I’m trying to set up a directional light to rotate based on the time of day (ranged 0-2400) but the sun doesn’t come up until 12pm. (1200) I’m terrible at math, can someone recommend what I should do to make the sun rise and set at the appropriate times? To be clear, I want to control the sun rotation with a slider that represents the time of the day, between 0 and 2400. Here’s an image of my construction script so far (ignore the clouds ****, that’s for weather.) Suntime mult is 15 because 360 degrees divided by 24 hours a day is 15, but my math reasoning is *probably *wrong because I’m an idiot. Also Time is divided by 100 so that the values can be between 0 and 24 to be multiplied by 15 to reach a maximum value of 360, for the rotation. Sorry if this doesn’t make sense, I’m not very good at programming/math/logic haha.
I didn’t read your whole post The math is simple, you have units going from 0000-2400, while a rotation goes from 0-360. To convert from the time unit to a rotation, just multiply the time value by 0.15 to get a value between 0 and 360. The reason the sun isn’t coming up until 12 PM is that you are only using a pitch rotation. Just like in real life the sun will be up for 12 hours if it is exactly centered in the sky. You’ll need to use yaw rotation to simulate latitude, kind of like how the sun has different “heights” in the sky depending on your location on the Earth.
Do I need to have varying yaw values at different times of the day or will just setting one yaw value change when the sun comes up/goes down?
You should only need to change the yaw when you want to change between the 4 seasons/sunlight duration.