Some Particle help ... pls

Posted By: Rohiaw

Some Particle help ... pls - 10/19/09 21:28

So lately, I've wanted to create a "ghost"-like player that floats around when you die ( kinda like in WoW ).
I created a small level to test it in and a transparent object to which i applied it as an emitter to particles.

This is what it looks like:


BUT, when i move the character, it does this trail ...


Is there a way to remove this trail that it leaves behind? I would like the particles to move in respect with the object (transparent), so that they would remain the way they did in the first picture.

Thanks laugh
Posted By: darkinferno

Re: Some Particle help ... pls - 10/20/09 12:05

that is how particles behave, if you want them to follow your player, you'd probably have to do some complex vector coding... which i cant do grin OR you'll probably have to make each particle fade out and move quicker. so the old particles get removed quickly before the new particles are created...
Posted By: Petra

Re: Some Particle help ... pls - 10/20/09 12:25

This is not complex but in fact simple, you only need to add the player position to the particles own movement in the particle function. Like this:

...
vec_set(p.x,p.skill_x);
vec_add(p.x,my.x);
...

and then you move the particle with its skill_x/y/z instead of its x/y/z vector.
Posted By: Rohiaw

Re: Some Particle help ... pls - 10/20/09 14:01

i'll try that code out and see how it works. wink
Posted By: Rohiaw

Re: Some Particle help ... pls - 10/20/09 14:22

I tried the code ... but it didnt do much of anything.

This is the code that concerns the particles:
Code:
function orbEffectsDefinition(PARTICLE* orbs){
	orbs.bmap = effect_bmp;
	orbs.alpha = 50;
	orbs.vel_x = random( 3 ) - 1.500;
	orbs.vel_y = random( 3 ) - 1.500;
	orbs.vel_z = random( 3 ) - 1.500;
	orbs.size = 1;
	orbs.gravity = 1;
	orbs.flags |= (BRIGHT|MOVE|BEAM|OVERLAY);
	orbs.event = orbEffect_spec_fun;
}

function orbEffects(){
	vec_scale(normal,10);
	effect(orbEffectsDefinition, 120, player.x, vector(60,60,60));
}



Can you pls tell me where to add that code, Petra ?
If its not to much to ask ...
Thanks again laugh
Posted By: Petra

Re: Some Particle help ... pls - 10/20/09 15:09

When you use the MOVE flag then my code wont work. You must then add the players speed to the particle position.

function orbEffectsDefinition(PARTICLE* orbs){
vec_set(orbs.skill_x,player.x); <==
orbs.bmap = effect_bmp;
orbs.alpha = 50;
orbs.vel_x = random( 3 ) - 1.500;
orbs.vel_y = random( 3 ) - 1.500;
orbs.vel_z = random( 3 ) - 1.500;
orbs.size = 1;
orbs.gravity = 1;
orbs.flags |= (BRIGHT|MOVE|BEAM|OVERLAY);
orbs.event = orbEffect_spec_fun;
}

and in the orbEffect function:

vec_sub(orbs.x,orbs.skill_x);
vec_add(orbs.x,player.x);
vec_set(orbs.skill_x,player.x);

Posted By: Rohiaw

Re: Some Particle help ... pls - 10/20/09 15:23

Just one problem. The orbEffect function cannot access the "orbs" PARTICLE* variable - as it is a parameter.
What to do ?? smirk
Posted By: Rohiaw

Re: Some Particle help ... pls - 10/20/09 15:28

by the way - you can parse your code like this:

[code ] ===================> Without the space after the "e"
code pasted here
[/code ] ===================> Without the space after the "e"

It will look like this:
Code:
code pasted here



Its much more efficient. wink
Posted By: Petra

Re: Some Particle help ... pls - 10/20/09 15:34

I meant not orbEffects but orbEffect_spec_fun.

I know the code tag but am too lazy to use it laugh
Posted By: Rohiaw

Re: Some Particle help ... pls - 10/20/09 15:35

hehe XD - i'll try the code again 10x
Posted By: Rohiaw

Re: Some Particle help ... pls - 10/20/09 15:38

OMFG OMFG OMFG OMFG OMFG OMFG OMFG
It works !!
Thanks again Petra !! grin
© 2023 lite-C Forums