Trailing effect for rockets or jets?

Posted By: CyberGhost

Trailing effect for rockets or jets? - 06/19/14 20:59

How do I make an effect of a trail for a jet plane or a rocket? It will be fascinating! I tried to do it ,but something wrong happens that makes particles move in different directions
Posted By: Stansmedia

Re: Trailing effect for rockets or jets? - 06/20/14 06:41

Something like this?

Code:
function smokefnc(PARTICLE *p)
{
    p.alpha -= p.skill_a*time_step;
    p.size += p.skill_a*time_step;
    if (p.blue > 0) { p.blue -= p.skill_a*time_step*2; }
    if (p.red > 0) { p.red -= p.skill_a*time_step*2; }
    if (p.green > 0) { p.green -= p.skill_a*time_step*2; }
    if (p.alpha <= 0) p.lifespan = 0;
}

function smoke(PARTICLE* p)
{
	vec_set(p.blue,vector(150,150,150));
   set(p, MOVE | BRIGHT | TRANSLUCENT);
   p.alpha = 50+random(20);
   p.size = 0.1+random(1.5);
   p.gravity = -0.025;
   p.skill_a = 2; // fade factor
   p.event = smokefnc;
}


effect(smoke,1,my.x,nullvector);

Posted By: CyberGhost

Re: Trailing effect for rockets or jets? - 06/20/14 13:31

... So, I won't use BEAM or STREAK? What is difference between them any way? And how would they change vel_x/y/z functionality?
Posted By: DLively

Re: Trailing effect for rockets or jets? - 06/20/14 13:55

they dont. those are flags.
Read the manual.
Posted By: Stansmedia

Re: Trailing effect for rockets or jets? - 06/20/14 16:00

beam causes the particle the multiply itself based on the direction - making it kind of like a "train" i guess. Streak stretches the particle. For a smoke, or rocket smoke, you don't really want to set a velocity speed. If it was a spark, or a blood splatter, then you would want to use the velocity. if you want to spread the particles on creation use:
Code:
effect(smoke,1,vector(my.x+random(16)-8,my.y+random(16)-8,my.z+random(16)-8),nullvector);

Posted By: CyberGhost

Re: Trailing effect for rockets or jets? - 06/20/14 18:33

OK. Thnx.
Posted By: CyberGhost

Re: Trailing effect for rockets or jets? - 06/20/14 21:42

... btw why do I need to set gravity?
Posted By: Stansmedia

Re: Trailing effect for rockets or jets? - 06/20/14 22:47

Smoke rises.. i think. Dont quote me on it.
Posted By: CyberGhost

Re: Trailing effect for rockets or jets? - 06/21/14 01:33

But the rocket's smoke doesn't rise. I meant a bazooka weapon rocket ,not kinda' Tomahoke rocket (I think I spelled it wrong tongue )
Posted By: DLively

Re: Trailing effect for rockets or jets? - 06/21/14 04:30

Smoke rises regardless of what it is emitting it wink
Posted By: Reconnoiter

Re: Trailing effect for rockets or jets? - 06/21/14 09:54

If you don't want gravity just it to zero than tongue . Or if you are not sure what you want, watch a video of a game where you think the rocket+smoke looks awesome and carefully observe how they made it (for example: how do their smoke particles move?).
Posted By: CyberGhost

Re: Trailing effect for rockets or jets? - 06/21/14 18:07

OK. I have just one question. I know it's very very dumb and newbie-only ,but to make sure: Which particle function is executed EVERY FRAME? The one set in the "effect()" instruction or the one set by "event" parameter of the particle or both? The manual says the first one ,but I wanna be sure ...
Posted By: CyberGhost

Re: Trailing effect for rockets or jets? - 06/23/14 12:51

frown ...
Posted By: Superku

Re: Trailing effect for rockets or jets? - 06/23/14 13:38

See manual -> effect, then the example code and you will/ should realize that the particle function used as an effect(...) parameter gets only called once for initialization, p.event (if any) every frame.
Posted By: CyberGhost

Re: Trailing effect for rockets or jets? - 06/23/14 13:51

Thanx laugh .

The manual here: http://manual.conitec.net/aent-effect.htm
(in the "parameters" sections) says: "function: Particle function; runs every frame ". That is what confused me ...
Posted By: Superku

Re: Trailing effect for rockets or jets? - 06/23/14 14:18

Hm I see what you mean. Usually a particle function has the following template:

Code:
void p_fnc(PARTICLE* p)
{
	set(p,MOVE);
	...
	p.lifespan = 16;
	p.event = p_fnc_event or NULL;
}



When you don't want to have a fade out function you normally write p.event = NULL; but I guess the event is set to the initialization function (p_fnc here) by default (which would not make much sense then as you overwrite lifespan, vel_xyz and the like over and over). Just always use p.event then.
Posted By: CyberGhost

Re: Trailing effect for rockets or jets? - 06/23/14 14:34

I see ....

Thanx a lot for clarification laugh .....
© 2024 lite-C Forums