1 registered members (henrybane),
1,499
guests, and 1
spider. |
Key:
Admin,
Global Mod,
Mod
|
|
|
particle trails
#307129
01/27/10 12:36
01/27/10 12:36
|
Joined: Jul 2008
Posts: 128 Ukraine
BastovBros
OP
Member
|
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) :
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
|
|
|
Re: particle trails
[Re: BastovBros]
#307404
01/29/10 02:20
01/29/10 02:20
|
Joined: Jul 2008
Posts: 1,178 England
MrGuest
Serious User
|
Serious User
Joined: Jul 2008
Posts: 1,178
England
|
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) :
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,
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
|
|
|
|