2 registered members (AndrewAMD, TipmyPip),
13,353
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
moving particles
#148939
08/19/07 05:23
08/19/07 05:23
|
Joined: Jul 2002
Posts: 857 Québec
Marky Mark
OP
User
|
OP
User
Joined: Jul 2002
Posts: 857
Québec
|
Hey, I got a code that create a kind of volumetric fog using a model. My problem is that my model is moving (you can see how in the code). I want the fog to also move.. how can I do this? thanks! Code:
action cloud_object { my.skill1 = 0; my.alpha = 98; my.transparent = on; while(1) { // generate cloud particals once while (my.skill1 < ent_vertices(my)) // repeat till all vertices are passed { vec_for_vertex(temp.x,me,my.skill1); if (temp.z < my.z) { temp.z -= random(20); //temp.z -= random(20); temp.y += random(120)-60; //temp.y += random(120)-60; temp.x += random(20)-10; //temp.x += random(20)-10; effect(dark_cloud,1,temp,nullvector); } if (temp.z < my.z-200) { temp.z += random(20); temp.y += random(120)-60; //temp.y += random(120)-60; temp.x += random(10)-5; effect(mid_cloud,1,temp,nullvector); } if (temp.z > my.z) { temp.z += random(20); temp.y += random(120)-60; //temp.y += random(120)-60; temp.x += random(10)-5; effect(light_cloud,1,temp,nullvector); } my.skill1 += 1; } //my.skill1 = 0;
wait(1); } //MOVEMENT // NOTE: LAISSER LE CHIFFRE AVANT TIME_STEP PAREIL POUR TOUTES LES ACTIONS DE L'ORAGE. while(picked_angle == 0) { wait(1); } // wait until choose_way has run my.pan = picked_angle; while(1) { temp.x = 2*time_step; // change 2 to whatever speed you want temp.y = 0; temp.z = 0; c_move(me,temp,nullvector,null); wait(1); } }
Last edited by Marky Mark; 08/19/07 05:23.
Yeah! IE sucks, use Mozilla... Marc Rémillard.
|
|
|
Re: moving particles
[Re: EpsiloN]
#148941
08/20/07 01:07
08/20/07 01:07
|
Joined: Jul 2002
Posts: 857 Québec
Marky Mark
OP
User
|
OP
User
Joined: Jul 2002
Posts: 857
Québec
|
Thanks I'll give it a try
Yeah! IE sucks, use Mozilla... Marc Rémillard.
|
|
|
Re: moving particles
[Re: Marky Mark]
#148942
08/20/07 03:04
08/20/07 03:04
|
Joined: Jul 2002
Posts: 857 Québec
Marky Mark
OP
User
|
OP
User
Joined: Jul 2002
Posts: 857
Québec
|
Here, note that I commented in the first while(1) loop. I also changed player to raincurtain, because this is the entity that generates the particles that is moving. I want the particles to follow this invisible entity, not the player. I get no errors, but its not moving... Code:
entity* raincurtain;
action cloud_object { raincurtain = me; my.skill1 = 0; my.alpha = 98; my.transparent = on; //while(1) //{ //MOVEMENT // NOTE: LAISSER LE CHIFFRE AVANT TIME_STEP PAREIL POUR TOUTES LES ACTIONS DE L'ORAGE. while(picked_angle == 0) { wait(1); } // wait until choose_way has run my.pan = picked_angle; while(1) { temp.x = 2*time_step; // change 5 to whatever speed you want temp.y = 0; temp.z = 0; c_move(me,temp,nullvector,null); wait(1); } // generate cloud particals once while (my.skill1 < ent_vertices(my)) // repeat till all vertices are passed { my.x = raincurtain.x; my.y = raincurtain.y; my.z = raincurtain.z; //clou(); vec_for_vertex(temp.x,me,my.skill1); if (temp.z < my.z) { temp.z -= random(20); //temp.z -= random(20); temp.y += random(120)-60; //temp.y += random(120)-60; temp.x += random(20)-10; //temp.x += random(20)-10; effect(dark_cloud,1,temp,nullvector); } if (temp.z < my.z-200) { temp.z += random(20); temp.y += random(120)-60; //temp.y += random(120)-60; temp.x += random(10)-5; effect(mid_cloud,1,temp,nullvector); } if (temp.z > my.z) { temp.z += random(20); temp.y += random(120)-60; //temp.y += random(120)-60; temp.x += random(10)-5; effect(light_cloud,1,temp,nullvector); } my.skill1 += 1; } //my.skill1 = 0;
// wait(1); //}
}
Yeah! IE sucks, use Mozilla... Marc Rémillard.
|
|
|
Re: moving particles
[Re: Nems]
#148944
08/21/07 03:23
08/21/07 03:23
|
Joined: Jul 2002
Posts: 857 Québec
Marky Mark
OP
User
|
OP
User
Joined: Jul 2002
Posts: 857
Québec
|
I think a good way would be to "destroy" the particles after X frames, then Recreate them, using the new position of the generating entity... How can I do this?
Last edited by Marky Mark; 08/21/07 03:25.
Yeah! IE sucks, use Mozilla... Marc Rémillard.
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|