Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
3 registered members (TedMar, AndrewAMD, fairtrader), 578 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Strange but logic #125332
04/20/07 20:26
04/20/07 20:26
Joined: Mar 2005
Posts: 969
ch
Loopix Offline OP
User
Loopix  Offline OP
User

Joined: Mar 2005
Posts: 969
ch
I have this line in my lensflare script to fade on/off the flares when the camera turns towards/away from the sun:
Code:
IF (camera.pan > sun_angle.pan + 25) || (camera.pan < sun_angle.pan - 25) || (camera.tilt < sun_angle.tilt - 20) || (camera.tilt > sun_angle.tilt + 20) {
IF (flare1_ent.alpha > 0) { flare1_ent.alpha -= flare_fadespeed * time_step; } ELSE { flare1_ent.alpha = 0;}}



Now the problem is: When I pan with my camera 360', the flares won't be visible anymore How can I fix this behaviour...probable needs some vector operation wich I don't know

Thx!

Re: Strange but logic [Re: Loopix] #125333
04/20/07 22:08
04/20/07 22:08

A
Anonymous
Unregistered
Anonymous
Unregistered
A



check you camera.pan
if it gets > 360 or < 0 this will help: camera.pan%=360;

mercuryus

Re: Strange but logic [Re: Loopix] #125334
04/20/07 22:11
04/20/07 22:11
Joined: Jan 2007
Posts: 651
Germany
R
RedPhoenix Offline
User
RedPhoenix  Offline
User
R

Joined: Jan 2007
Posts: 651
Germany
Quote:

ang(x)
Verschiebt einen Winkel durch successives Addieren bzw. Subtrahieren von 360 Grad in den -180 .. +180 Grad Bereich. Sinnvoll, um die Differenzen von Winkeln zu berechnen.
Parameter:
x - beliebiger Winkel.
Rückgabewert:
Winkel in das Intervall -180 .. +180 verschoben.

Geschwindigkeit:
Schnell
Beispiel:
x = ang(0); // x ist 0
x = ang(-350); // x ist 10
x = ang(185); // x ist -175





Sorry I had only the German version of the manual there. Of course you probably have to rewrite your code for it, but it should solve the jump of the pan values from 360 to 0 so that you can use the prinziple of the code.

EDIT: You need a abs() command to avoid a jump between 180 and -180

Last edited by RedPhoenix; 04/20/07 22:16.
Re: Strange but logic [Re: RedPhoenix] #125335
04/20/07 22:20
04/20/07 22:20
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline
User
tompo  Offline
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
Or use ang(x) or use modulo my.pan %= 360;


Never say never.
Re: Strange but logic [Re: ] #125336
04/20/07 22:24
04/20/07 22:24
Joined: Mar 2005
Posts: 969
ch
Loopix Offline OP
User
Loopix  Offline OP
User

Joined: Mar 2005
Posts: 969
ch
Daaaanke! camera.pan %=360; war die Lösung! Wie einfach und schön doch das Leben ist

Re: Strange but logic [Re: Loopix] #125337
04/20/07 22:38
04/20/07 22:38
Joined: Jan 2007
Posts: 651
Germany
R
RedPhoenix Offline
User
RedPhoenix  Offline
User
R

Joined: Jan 2007
Posts: 651
Germany
Warum einfach wenns auch kompliziert geht???

Re: Strange but logic [Re: RedPhoenix] #125338
04/20/07 23:00
04/20/07 23:00
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
Also, just an idea...

instead of doing all the if's and stuff, you might get good results by finding the difference in angles between the camera and the sun, then simply fade according to the length of the result...

Code:

define fScale = 90; // fading range in degree's
vec_diff(temp, sun_angle, camera.pan);
result = vec_length(temp);
sunFlare.alpha = clamp(100 - (result*fScale*1.11), 0, 100);




xXxGuitar511
- Programmer

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