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
1 registered members (henrybane), 1,499 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19054 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
particle trails #307129
01/27/10 12:36
01/27/10 12:36
Joined: Jul 2008
Posts: 128
Ukraine
BastovBros Offline OP
Member
BastovBros  Offline OP
Member

Joined: Jul 2008
Posts: 128
Ukraine
My BEAM trails don't work. I have a model moving on physics, and here is the code I use for the particle trails (modified from the GS sample) :
Code:
function trace_wing2_alpha(PARTICLE *p)
{
    p.alpha -= 0.1*time_step;
    p.size -=0.1*time_step;
    if (p.alpha <= 0) p.lifespan = 0;
}

function trace_wing2(PARTICLE *p)
{
   set(p, BRIGHT|TRANSLUCENT|BEAM);
   p.alpha = 1;
   p.size = 3;
   p.event = trace_wing2_alpha;
}
action fly(){
while(1){
vec_for_vertex(wing_trace2.x,me,2258);			
vec_set(last_pos_wing2.x,wing_trace2.x);
here is forward movement code using physics parameters...
phent_addforcelocal (my, vector(200,0,0),nullvector);	 
effect(trace_wing2,10,wing_trace2.x,vec_sub(last_pos_wing2.x,wing_trace2.x));
wait(1);}
}


This code works for STREAK particles.... but BEAMs are simply not displayed. I think it is because I use engine physics for movement. I have applied the same code for the bullets which movement is based on vectors (e.g. c_move(vector_forward,nullvector, NULL);) Any ideas how to fix this? thx in advance


a generator of dull questions smile
Re: particle trails [Re: BastovBros] #307132
01/27/10 12:43
01/27/10 12:43
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
Try to set the alpha higher, for testing :
p.alpha = 100;

A alpha from 1 is nearly transparent.

Re: particle trails [Re: Widi] #307140
01/27/10 13:52
01/27/10 13:52
Joined: May 2009
Posts: 445
Peine, Germany
Razoron Offline
Senior Member
Razoron  Offline
Senior Member

Joined: May 2009
Posts: 445
Peine, Germany
Do you have commercial edition? my.beam just works on the commercial edition.

Re: particle trails [Re: Razoron] #307191
01/27/10 18:16
01/27/10 18:16
Joined: Jul 2008
Posts: 128
Ukraine
BastovBros Offline OP
Member
BastovBros  Offline OP
Member

Joined: Jul 2008
Posts: 128
Ukraine
>Razoron,
yep, I have commercial... and as I said beam works fine for the bullets which move with c_move, but does not work with the plane which moves with phent_addlocalforce....
>Widi
I tried 100 before, now set 1 because it looks how it should look like.... though the particles work only with STREAK...
I thought that maybe phent_addforcelocal does not use quants and this vector setting in a loop understands only quants.....That's only my assumption...


a generator of dull questions smile
Re: particle trails [Re: BastovBros] #307404
01/29/10 02:20
01/29/10 02:20
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
Originally Posted By: BastovBros
My BEAM trails don't work. I have a model moving on physics, and here is the code I use for the particle trails (modified from the GS sample) :
Code:
function trace_wing2_alpha(PARTICLE *p)
{
    p.alpha -= 0.1*time_step;
    p.size -=0.1*time_step;
    if (p.alpha <= 0) p.lifespan = 0;
}

function trace_wing2(PARTICLE *p)
{
   set(p, BRIGHT|TRANSLUCENT|BEAM);
   p.alpha = 1;
   p.size = 3;
   p.event = trace_wing2_alpha;
}
action fly(){
while(1){
vec_for_vertex(wing_trace2.x,me,2258);			
vec_set(last_pos_wing2.x,wing_trace2.x);
here is forward movement code using physics parameters...
phent_addforcelocal (my, vector(200,0,0),nullvector);	 
effect(trace_wing2,10,wing_trace2.x,vec_sub(last_pos_wing2.x,wing_trace2.x));
wait(1);}
}


This code works for STREAK particles.... but BEAMs are simply not displayed. I think it is because I use engine physics for movement. I have applied the same code for the bullets which movement is based on vectors (e.g. c_move(vector_forward,nullvector, NULL);) Any ideas how to fix this? thx in advance
Hey,

You're overwriting both last_pos_wing2 and wing_trace2 before you're calculating, so the BEAM length will always be 0,

Code:
while(1){
   vec_set(last_pos_wing_trace2.x, wing_trace2.x);
   phent_addforcelocal (my, vector(200,0,0),nullvector);
   vec_for_vertex(wing_trace2.x, me, 2258);
   effect(trace_wing2,10,wing_trace2.x,vec_sub(last_pos_wing2.x,wing_trace2.x));
   wait(1);
}

*SHOULD* hopefully work


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