Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
1 registered members (Grant), 999 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 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 | chip programmers | 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