The equation used to calculate the angleThisFrame is dimensionally wrong:
- Time.deltaTime is [sec]/[frame]
- 360 is [degrees]
- minutesPerSecond is [min]/[sec]
so angleThisFrame, dimensionally, is [sec]/[frame] * [min]/[sec] / [degrees], ending with a [min] / ( [frame] * [degrees] ), instead of the correct dimension of [degrees]/[frame]
The correct equation is
which gives a correct dimension of [degrees]/[frame], and if we set for example 60 minutesPerSecond, we get a complete day/night cycle in 24 seconds.
As a side note, I used only the Rotate() and no additional Quaternion variable:
[code]public class DayCycle : MonoBehaviour {
public float minutesPerSecond;
float degreesPerFrame;
void Update () {
degreesPerFrame = minutesPerSecond * Time.deltaTime * 360 / 1440;
transform.Rotate(degreesPerFrame,0,0,Space.Self);
}
}[/code]