- Home /
Weird rotation Log that makes no sense ?
Hello, I am trying to program a day and night cycle, by rotating the sunlight and a moonlight.
pivot.transform.Rotate (Vector3.up * cycleTimeMult * Time.deltaTime);
Debug.Log (daytime.ToString ());
//handle more
if (daytime <= 0) { //if nighttime
sunLight.intensity = 0;
nightLight.intensity = 1;
} else {
sunLight.intensity = 1;
nightLight.intensity = 0;
}
When I try to get the rotation, it logs somehting like -0.7069825 , and over time it is zero and goes back and after some cycles it switches to positive and its really weird. I can't determine what time of day it is when the rotation is something like -0.7 then 0 and after 2 days 0.3 or something.
Comment
Answer by Slastraf · Jun 29, 2017 at 11:09 AM
Solved it by using location of sun, when its rotating around a pivot as a child
Your answer
![](https://koobas.hobune.stream/wayback/20220612125128im_/https://answers.unity.com/themes/thub/images/avi.jpg)