Gamestudio Links
Zorro Links
Newest Posts
Help!
by VoroneTZ. 10/14/25 05:04
Zorro 2.70
by jcl. 10/13/25 09:01
ZorroGPT
by TipmyPip. 10/12/25 13:58
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 10/11/25 18:45
Reality Check results on my strategy
by dBc. 10/11/25 06:15
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (Quad, VoroneTZ, Nymphodora), 8,449 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
joenxxx, Jota, krishna, DrissB, James168
19170 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Rotate Sun smoothly to a target angle? #398051
03/26/12 22:01
03/26/12 22:01
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline OP
Expert
Espér  Offline OP
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
hi there..

i managed to rotate the sun of a level by hitting left/right key with this code:
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? ._.

Last edited by Espér; 03/26/12 22:01.

Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: Rotate Sun smoothly to a target angle? [Re: Espér] #398269
03/30/12 14:27
03/30/12 14:27
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline OP
Expert
Espér  Offline OP
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
I've still not found a solution ._.
help, plz :'(


Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: Rotate Sun smoothly to a target angle? [Re: Espér] #398273
03/30/12 15:00
03/30/12 15:00
Joined: Apr 2005
Posts: 4,506
Germany
F
fogman Offline
Expert
fogman  Offline
Expert
F

Joined: Apr 2005
Posts: 4,506
Germany
I can´t write you any code because I´m very busy atm.
But you can try vec_lerp and use the sin function to set the factor "f".
This should give you a smooth rotation.


no science involved
Re: Rotate Sun smoothly to a target angle? [Re: fogman] #398275
03/30/12 15:14
03/30/12 15:14
Joined: Oct 2011
Posts: 1,082
Germany
C
Ch40zzC0d3r Offline
Serious User
Ch40zzC0d3r  Offline
Serious User
C

Joined: Oct 2011
Posts: 1,082
Germany
Code:
while(sun_angle.pan < 50)
{
    sun_angle.pan += 3*time_step;
    wait(1);
}



Why this shouldnt work? OR you dont want static offsets?

Re: Rotate Sun smoothly to a target angle? [Re: Ch40zzC0d3r] #398279
03/30/12 16:18
03/30/12 16:18
Joined: Apr 2005
Posts: 4,506
Germany
F
fogman Offline
Expert
fogman  Offline
Expert
F

Joined: Apr 2005
Posts: 4,506
Germany
Quote:
The rotating speed needs to get faster at the start, and slower to the end (smooth rotating)...



no science involved

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1