[SOLVED] SkyControl: how to detect when it's day or night?

Hi monkeys! This question is more oriented to @sgold.

So, I want to know if is there a way or method in the SkyControl plugin it’s day or night to determine the intensity of the main light. I have been using approximated values, but I prefer to test wheter it’s night than testing wheter it’s 7pm.

I have been searching in the source code, but didn’t found anything in the SkyControl, SunAndStars and Updater classes.


Your question is a bit confusing. I hope I’ve interpreted it correctly.

skyControl.getSunAndStars().getSunDirection() returns a direction vector pointing toward the sun. If the y-component of this vector is positive, then the sun is above the horizon. If it’s negative, the sun is below the horizon.

I hope this information is helpful to you.


What I understood is he want a value ("[…] intensity of the main light […]") to determine the hour of day-night. For example, if the time is 12 PM, then the light intensity must be the higher possible, let’s say 1, and when is night, like 12 AM, this value is 0.1 (just an example).

By saying it, he must think this plugin works with a main light value and change it depending on time. Personally, I don’t think it works like it, because the night value depends on moon or stars position, clouds and such.

Yeah, that’s exactly what i’m looking for! I’m only changing the intensity of the light at day since the default makes the terrain look very dark. And at night it looks very bright… Thanks @sgold and @afonsolage for the help!