Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (AemStones, AndrewAMD, gamers, Kingware), 1,679 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19054 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: Particles from one vertex to another [Re: Grimber] #83363
07/31/06 20:52
07/31/06 20:52
Joined: Jun 2005
Posts: 4,875
broozar Offline
Expert
broozar  Offline
Expert

Joined: Jun 2005
Posts: 4,875
managed to attach the sprite to the desired vertex, and i get the angle (had to correct it gith -90, as you said grimber).
however the sprite's centre is attached to the vertex, but I need the middle of the left edge to be attached.. help me please.
Code:

//entities
entity* podL;
entity* podR;
entity* lightning;

//vars and vecs
var vec_pos1[3]; //left pod
var vec_pos2[3]; //right pod
var vec_direction[3]; //from left to right
var lightangle[3];
var dist;

//actions
action pod1{
podL=my;
my.material=poddy;
my.transparent=off;
}

action pod2{
podR=my;
my.material=poddy;
my.transparent=off;
}

action sprite{
proc_late();
lightning=my;
my.bright=on;
while(1){
my.frame += 2*TIME_STEP;
my.frame %= 55;
vec_for_vertex (vec_pos1,podL,1220);
vec_for_vertex (vec_pos2,podR,1219);
dist=vec_dist (vec_pos1, vec_pos2);
vec_set (vec_direction, vec_pos1);
vec_sub (vec_direction, vec_pos2);
vec_to_angle (lightangle, vec_direction);
my.x = vec_pos1.x; //--->what to add here?<---
my.y = vec_pos1.y;
my.z = vec_pos1.z;
my.pan=(lightangle.pan +90);
my.tilt=lightangle.tilt;
my.roll=-lightangle.tilt;
wait(1);
}
}


PS: the angle values just work as posted, dunno why it is that way...

Re: Particles from one vertex to another [Re: broozar] #83364
07/31/06 21:14
07/31/06 21:14
Joined: May 2005
Posts: 338
Brasil
Filipe Offline
Senior Member
Filipe  Offline
Senior Member

Joined: May 2005
Posts: 338
Brasil
maybe try
Code:

my.x = (vec_pos1.x+vec_pos2.x)/2;
my.y = (vec_pos1.y+vec_pos2.y)/2;
my.z = (vec_pos1.z+vec_pos2.z)/2;



Re: Particles from one vertex to another [Re: Filipe] #83365
07/31/06 21:36
07/31/06 21:36
Joined: Jun 2005
Posts: 4,875
broozar Offline
Expert
broozar  Offline
Expert

Joined: Jun 2005
Posts: 4,875
great, thanks! a shame, we had this in maths classes half a year ago, and i could not remember it... thanks anyway!

"proof" ^^ (just look at the lightning; pods are without mats settings, looks pretty like nothing, but stay tuned, i will add some gr8 normal maps)


Re: Particles from one vertex to another [Re: broozar] #83366
07/31/06 23:03
07/31/06 23:03
Joined: Sep 2003
Posts: 4,959
US
G
Grimber Offline
Expert
Grimber  Offline
Expert
G

Joined: Sep 2003
Posts: 4,959
US
oops! hehe i totaly forgot they moved the origin point of sprites ( im still use to the older way where it was centered alogn the bottem edge

looks ok though with Filipe's fix
( you could use vec_lerp as it does the same thing in one line)

vec_lerp(sprite.x,vertex1.x,vertex2.x,0.5);

hope to see in in action sometime soon

Oh don;t forget, if your pod is moving then you will have to run all these things in a loop, since everything is moving the sprite has to keep up:)


Last edited by Grimber; 07/31/06 23:06.
Re: Particles from one vertex to another [Re: Grimber] #83367
08/01/06 19:45
08/01/06 19:45
Joined: Feb 2006
Posts: 2,185
mpdeveloper_B Offline
Expert
mpdeveloper_B  Offline
Expert

Joined: Feb 2006
Posts: 2,185
Code:

function slim_saber_func()
{
proc_late();
my.scale_x = 0.5;
my.scale_y = 0.5;
my.scale_x = 0.5;
my.flare = off;
my.transparent = on;
my.bright = on;
my.passable = on;
my.alpha = 100;
vec_for_vertex (pos01 ,slim_core_ent, saber_vec01);
vec_for_vertex (pos02 ,slim_core_ent, saber_vec02);
vec_to_angle (my.pan, pos02);
my.x = (pos01.x+pos02.x)/2;
my.y = (pos01.y+pos02.y)/2;
my.z = (pos01.z+pos02.z)/2;
while(my.alpha > 0)
{
my.alpha -= 80 *time;
wait(1);
}
ent_remove(me);
}


how would i fix this to pan toward the second vector?
also how could i do collision?

Last edited by Manslayer101; 08/01/06 19:51.

- aka Manslayer101
Re: Particles from one vertex to another [Re: mpdeveloper_B] #83368
08/28/06 16:33
08/28/06 16:33
Joined: Feb 2006
Posts: 2,185
mpdeveloper_B Offline
Expert
mpdeveloper_B  Offline
Expert

Joined: Feb 2006
Posts: 2,185
can anyone help?


- aka Manslayer101
Page 2 of 2 1 2

Moderated by  adoado, checkbutton, mk_1, Perro 

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