Posted By: JoGa
Particle moves with an Entity on a vertex - 02/06/12 10:29
Hey!
I have a questiona about particles.
My Particle Function moves the particle relativ with an entity.
The example from particles.c helped me.
But I need a additon, I can't do myself because I don't know how I should do that:
The particle is created on a vertex of the entity.
This entity is animated, so the function as it is, does not fit 100%.
How is it possible, to "tell" the particle to take the vertex-position?
The function "effect" does not have a return value lik the ent_create-function has.
Otherwise I could use this return value as a pointer and give him the vertexnumber as a skill p.skill70 for example.
Here is my code so far, I hope, somebody does understand my problem and can help me.
I have a questiona about particles.
My Particle Function moves the particle relativ with an entity.
The example from particles.c helped me.
But I need a additon, I can't do myself because I don't know how I should do that:
The particle is created on a vertex of the entity.
This entity is animated, so the function as it is, does not fit 100%.
How is it possible, to "tell" the particle to take the vertex-position?
The function "effect" does not have a return value lik the ent_create-function has.
Otherwise I could use this return value as a pointer and give him the vertexnumber as a skill p.skill70 for example.
Here is my code so far, I hope, somebody does understand my problem and can help me.
Code:
function p_flammen_in(PARTICLE *p) { p.alpha += p.skill_a*time_step; if (p.alpha >= 15) p.bmap = pct_p_fire02; if (p.alpha >= 30) p.bmap = pct_p_fire01; //if (p.alpha >= 50) p.event = p_flammen_out; if(!you) return; // example from particles.c if(p.skill_x != 0) { vec_add(p.x,your.x); vec_sub(p.x,p.skill_x); } vec_set(p.skill_x,your.x); // store old "you" position } function p_condition_burning(PARTICLE* p) { vec_add(p.vel_x,vector(random(2)-1,random(2)-1,0)); set(p, MOVE | BRIGHT | TRANSLUCENT); p.alpha = random(10); p.bmap = pct_p_fire03; p.size = 20+random(5); p.gravity = - 0.4; p.skill_a = 8+random(4); // fade factor p.event = p_flammen_in; } // in a while-loop to circle through the vertices vec_for_vertex(temp.x, my, integer(random(gesamt_vertices))); effect(p_condition_burning,15,temp.x,NULL);