Losing seconds

Hi, i was like one week struggling with it, and i can’t solve it.

  • I want to perform:
    I want to perform a sun rotation over an sphere(The typical day and night cycle), and i want to base it on the Gametime.speed (a variable = Time.deltaTime*(1000 for example)), when it does the rotation, i have it synchronized with the transitions of the skybox and the gametime.

  • The problem:In 1000 for example it’s good but if it goes more than 1000 for example 15000, the transitions are good but the velocity of the sun doesn’t.

  • My question: So my question is how to synchronized it for no losing seconds, i tried with Time.time, and a lot of stuff more and doesn’t help.

Thanks in advance…

PD: I know Unity Answers is not the site for “write me an script”, my script have 400 lines of code actually. And this is my only problem at the moment, the rest work perfectly.

Time.deltaTime varies from frame to frame, so you cannot use Time.deltaTime * 1000 and expect it to have any specific meaning. The typical solution is to decide on the number of seconds you want something to take, and then increment a timer each frame. The fraction timer/total_time would then get used in some function like Vector3.Slerp() or Quaternion.Slerp() to move the object. There is an example of a Sunrise/Sunset in the Vector3.Slerp() script reference page.