Particle glitch

Posted By: darksmaster923

Particle glitch - 11/02/09 06:05

For some reason, every time I move further away from my particle emitter, it moves farther away too. I have the tiger use
effect_local(p_blood, 200, me.x, normal);
but, it comes out like this
http://img101.imageshack.us/img101/6803/22294948.png

Where it looks like it is behind the tiger, and as I go farther away it goes farther behind the tiger
Posted By: Walori

Re: Particle glitch - 11/02/09 07:50

Well do you want it to be below the tiger? Then you should change

Code:
effect_local(p_blood, 200, me.x, normal);



to:

Code:
effect_local(p_blood, 200,vector( me.x,me.y,me.z), normal);


Because if you take only X the particle is made only to the X coord of entity, and if you'd need it to be below then you'd need at least Y coord (Z is also adviced) hope that made an y sence


EDIT: I stand corrected
Posted By: Widi

Re: Particle glitch - 11/02/09 10:42

@Walori:
you are false, if the compiler expect a vector and you only whrite my.x,the compiler takes my.y,my.z automatically for the vector!!!
(the same if you use my.pan (tilt,roll), my.blue (green,red)...)
so effect_local(p_blood, 200, me.x, normal); is right !!!

@darkmaster:
you are sure that the me-pointer is pointing to the tiger?
If yes, post your particlefunction for more help...
Posted By: darksmaster923

Re: Particle glitch - 11/03/09 03:30

The particle function
Code:
BMAP* blood_particle ="blood.tga";

function vec_randomize (VECTOR* vec, var range)
{
   vec_set(vec,vector(random(1)-0.5,random(1)-0.5,random(1)-0.5));
   vec_normalize(vec,random(range));
}
function p_alphafade(PARTICLE *p)
{
    p.alpha -= p.skill_a*time_step;
    if (p.alpha <= 0) p.lifespan = 0;
}
function p_blood(PARTICLE* p)
{
   VECTOR vTemp;
   vec_randomize(vTemp,2);
   vec_add(p.vel_x,vTemp);
   vec_set(p.blue,vector(random(255),random(255),255));
   set(p, MOVE | BRIGHT | TRANSLUCENT);
   p.alpha = 100;
   p.size = 2;
   p.gravity = 0.2;
   p.skill_a = 3; // fade factor
   p.event = p_alphafade;
}



The tiger function
Code:
function got_shot()
{
	effect_local(p_blood, 200, me.x, normal);
	//ptr_remove(me);
}
action test()
{
	var scale=0.2;
	VECTOR temp[3];
	var speed=3;
	me.material=mat_metal;
	me.scale_x=scale;
	me.scale_y=scale;
	me.scale_z=scale;
	me.emask= ENABLE_IMPACT;
	my.event=got_shot;
	c_setminmax(me);
	set(me,POLYGON);
	set(me,SHADOW);
	while(1)
	{
		vec_set(temp,camera.x); 
		vec_sub(temp,my.x); 
  		vec_to_angle(me.pan,temp); 
  		got_shot();
  		c_move(me,nullvector,vector(0,0,-speed),IGNORE_PASSABLE|GLIDE);
  		if(vec_dist(me.x,camera.x)<20)
  		{
			c_move(me,vector(-speed,0,0),nullvector,IGNORE_PASSABLE|GLIDE);
		}
		wait(1);
	}
}


Posted By: darksmaster923

Re: Particle glitch - 11/07/09 18:57

bump?
© 2024 lite-C Forums