Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 10:32
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
6 registered members (AndrewAMD, alibaba, fairtrader, ozgur, TipmyPip, Quad), 604 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: simple vector problem... [Re: Germanunkol] #127271
04/30/07 12:10
04/30/07 12:10
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
@Germanunkol: Yes you're right, sorry.
vec_for_angle "creates a unity vector pointing into the direction given by the angle" (quoted: The Manual

Re: simple vector problem... [Re: Germanunkol] #127272
04/30/07 12:14
04/30/07 12:14
Joined: Oct 2004
Posts: 1,655
T
testDummy Offline
Serious User
testDummy  Offline
Serious User
T

Joined: Oct 2004
Posts: 1,655
Germanunkol, you must be psychic.
I glanced at this thread three or four times, hoping by some chance, someone would actually suggest values were being overwritten.
Eventually, against good sense, I wasted my time writing the following...I 'hit refresh' and someone actually indeed, finally declares the possibility.

Really, you can't suggest the values were being overwritten without slightly implying that the question asker is 'incompetent'.

vec_for_fu<k is not function
Code:

//...
function prefunc_bottom_spray();


//...
Function func_bottom_spray() {
/*
I believe this or a variation of was sound, but
expected results are probably dependent upon whether
relevant variables are overwritten in the next function.
vel and position might have been overwritten in
prefunc_bottom_spray()
*/
var vel[3];
vec_set(vel, nullvector);
vec_for_angle(vel, ent_waterfall.pan);
vec_scale(vel, 8.45); //[optional]

//randomize [optional]
var i0 =0;
while (i0 < 3) {
temp[0] = random(0, 7.45);
if (random(1) < 0.5) {
temp[0] *= -1;
}
vel[i0] += temp[0];
i0 += 1;
}
vec_for_vertex(temp, my, 7);
effect(prefunc_bottom_spray, 1, temp, vel);
}



//...
Function prefunc_bottom_spray()
{
mat_particle_fall.specular_blue=clamp(my.blue+(d3d_fogcolor1.blue*ent_waterfall.fall_fogcol_fac)+ent_waterfall.fall_add_blue,0,255);
mat_particle_fall.specular_green=clamp(my.green+(d3d_fogcolor1.green*ent_waterfall.fall_fogcol_fac)+ent_waterfall.fall_add_green,0,255);
mat_particle_fall.specular_red=clamp(my.red+(d3d_fogcolor1.red*ent_waterfall.fall_fogcol_fac)+ent_waterfall.fall_add_red,0,255);

my.blue=mat_particle_fall.specular_blue;
my.green=mat_particle_fall.specular_green;
my.red=mat_particle_fall.specular_red;

my.bmap = bmp_bott_spray;
//my.vel_x = random(6) - 3 ; vel was overwritten
//my.vel_y = random(0.8) - 0.4; vel was overwritten
// I offer no claims of validity for these modifications.
// They are dummy or placeholder modifications only.
my.vel_y -= max(my.vel_y * 0.995, time_step * 0.35);
my.vel_x -= max(my.vel_x * 0.995, time_step * 0.35);
//my.vel_z = 4.5 ;
my.z = my.vel_z * my.skill_a - 1/2 * 5 * pow(my.skill_a, 2);
my.size = ent_waterfall.bott_spray_size;//4
my.alpha = ent_waterfall.bott_spray_alpha;//60
//my.gravity = 0.4 ;
my.streak = off;
my.flare = off;
if(ent_waterfall.bott_spray_bright == on){
my.bright = on;
}
else{
my.bright = off;
}
my.beam = off;
my.move = on;
my.transparent = on;
my.function = init_prefunc_bottom_spray;

//Why are vel and pos both set directly?
//my.x = my.x-10+random(ent_waterfall.bott_spray_width)-ent_waterfall.bott_spray_width/2;
//my.y = my.y+8+ent_waterfall.bott_spray_pos_y;
//my.z = (my.z+ent_waterfall.bott_spray_level)+(random(5)-2.5);

my.skill_a += time;
}



Although there seemed to be a superfluous instruction, what Thunder had probably would have worked.
Seemingly, vec_for_angle is a vec_set, vec_rotate, ... shortcut. Or is it?

Last edited by testDummy; 04/30/07 12:23.
Re: simple vector problem... [Re: testDummy] #127273
04/30/07 12:26
04/30/07 12:26
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
The algorithm of the vec_for_angle is nothing else than this: (according to the greatest of all time, the manual)
Code:

VECTOR.x = cos(ANGLE.pan)*cos(ANGLE.tilt);
VECTOR.y = sin(ANGLE.pan)*cos(ANGLE.tilt);
VECTOR.z = sin(ANGLE.tilt);



Re: simple vector problem... [Re: Xarthor] #127274
04/30/07 15:31
04/30/07 15:31
Joined: Mar 2005
Posts: 969
ch
Loopix Offline OP
User
Loopix  Offline OP
User

Joined: Mar 2005
Posts: 969
ch
Great input...thank you all

I'll let you know hoe far I got...in a couple of hours
I also realized that vec_for_fu<k is indeed not in the manual...probable a beta feature in experimental stage

Re: simple vector problem... [Re: Loopix] #127275
04/30/07 15:55
04/30/07 15:55
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
Not sure if this is what your looking for. This will offset the particles emmision within the width of the waterfall, relative to the ent's angles...

The velocity vector is set in the emmitter function, rotated by ent's angles [vec_rotate()], and then passed to the function...

Code:

// Width of the waterfall...
DEFINE sWidth, 10;
var np[3];
//
vec_for_vertex(np, my, 7);
vec_set(temp, vector(0, random(sWidth)-sWidth/2, 0));
vec_rotate(temp, my.pan);
vec_add(np, temp);
temp.x = random(6) - 3 ;
temp.y = random(0.8) - 0.4;
temp.z = 4.5 ;
vec_rotate(temp, my.pan);

effect(prefunc_bottom_spray, 1, np, temp);



Last edited by xXxGuitar511; 04/30/07 15:56.

xXxGuitar511
- Programmer
Re: simple vector problem... [Re: xXxGuitar511] #127276
04/30/07 18:17
04/30/07 18:17
Joined: Mar 2005
Posts: 969
ch
Loopix Offline OP
User
Loopix  Offline OP
User

Joined: Mar 2005
Posts: 969
ch
Perfect! Guitars works best concerning the rotation stuff...big thanks

Re: simple vector problem... [Re: Loopix] #127277
04/30/07 22:45
04/30/07 22:45
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
np...


xXxGuitar511
- Programmer
Page 2 of 2 1 2

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