Help with suns rotation
I have made a complex clock script and now I tried to sync the rotation of the sun to the time from that script but it seems that this solution I found online doesn't have any smoothing (that one is the commented line) and I'd like the sun to smoothly move towards it's next rotation which the system I used doesn't seem to work (The not commented lines) also I'd like to know if there's a better way to do this so that I could define what time the sun sets and rises as of right now it's just simply at 6 am and 6 pm. Script:
 void Update () {
         if (nightObject)
         {
             hourAndMinute = clock.hour + 12 + (((clock.minute * 100) / 60) / 100);
             //transform.eulerAngles = new Vector3(((hourAndMinute * 360f) / 24f) - 90f, 0, 0);
             transform.eulerAngles = Vector3.SmoothDamp(transform.localEulerAngles, new Vector3(((hourAndMinute * 360f) / 24f) - 90f, 0, 0), ref vector3, rotationSpeed);
         }
         else
         {
             hourAndMinute = clock.hour + (((clock.minute * 100) / 60) / 100);
             //transform.eulerAngles = new Vector3(((hourAndMinute * 360f) / 24f) - 90f, 0, 0);
             transform.eulerAngles = Vector3.SmoothDamp(transform.localEulerAngles, new Vector3(((hourAndMinute * 360f) / 24f) - 90f, 0, 0), ref vector3, rotationSpeed);
         }
     }
Your answer
 
 
             Follow this Question
Related Questions
Rotate clockwise/counterclockwise using Quaternion.Slerp() 0 Answers
Draw a ray from a gamobject and keep direction of the ray relative to the gameobjects rotation. 1 Answer
Quaternion Rotation - AngleAxis/EulerAngle 2 Answers
How to make a 2D sprite rotate towards a specific point while facing perpendicular to the camera ? 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                