hi there..
i managed to rotate the sun of a level by hitting left/right key with this code:
sun_angle.pan += (key_cul-key_cur)*time_frame;
sun_angle.pan %= 360;
sun_angle.tilt = fsin(sun_angle.pan, 45) + 45;
sun_light = sun_angle.tilt;
That works very well.. but was still a dummycode..
Now i created buttons to manage 4 different daytimes
(morning, noon, afternoon, night)
I tried several ways now..
A while loop wich stops if the sun_angle.pan reaches the given position
The smooth arithmetic
..
But it won´t work. The sun keeps rotating, or stops at a number i don´t want
My question now:
how to rotate the sun_angle.pan to a given angle?
The rotating speed needs to get faster at the start, and slower to the end (smooth rotating)...
Any idea? ._.