I wrote some simple time code, I showing in a clock the time of game (like 10:00pm), but now I need to rotate the sun using that values, and the sun rise near 5am and the sunset at 7pm (for longer days without changing the time speed).
C#
minute += timeSpeed * Time.deltaTime;
if (minute >= 60)
{
minute = 0f;
hour++;
}
if (hour >= 24)
{
day++;
hour = 0;
}
I was seeing here, I can do something like transform a value in hours to angle, but there’s no way to modify just the X rotation of a object, and the transform.Rotate add a value to the current rotation, and does not set it. I want to SET the rotation based on what time is it.
(sorry for my bad english)