Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (AndrewAMD, TipmyPip), 13,353 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
moving particles #148939
08/19/07 05:23
08/19/07 05:23
Joined: Jul 2002
Posts: 857
Québec
Marky Mark Offline OP
User
Marky Mark  Offline 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: Marky Mark] #148940
08/19/07 19:23
08/19/07 19:23
Joined: Jan 2006
Posts: 968
EpsiloN Offline
User
EpsiloN  Offline
User

Joined: Jan 2006
Posts: 968
your first while loop is endless , the function will never reach the second while loop so its pointless to have it.
If I understand what this function does , if you move the model you attached the function to you'll move the fog too. So , before the code after "while(1) {" put my.x = player.x; my.y = player.y and my.z = player.z; and it'll move with the player. You could also put it before wait(1); if there are problems.


Extensive Multiplayer tutorial:
http://mesetts.com/index.php?page=201
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 Offline OP
User
Marky Mark  Offline 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 Offline OP
User
Marky Mark  Offline 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: Marky Mark] #148943
08/20/07 22:25
08/20/07 22:25
Joined: Mar 2003
Posts: 4,264
Wellington
Nems Offline

.
Nems  Offline

.

Joined: Mar 2003
Posts: 4,264
Wellington
Maybe by giving the 'fog' its own movement script synched with the particles as an attached item or standalone.

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 Offline OP
User
Marky Mark  Offline 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.
Re: moving particles [Re: Marky Mark] #148945
08/22/07 19:30
08/22/07 19:30
Joined: Jul 2002
Posts: 857
Québec
Marky Mark Offline OP
User
Marky Mark  Offline OP
User

Joined: Jul 2002
Posts: 857
Québec
Any Idea?


Yeah! IE sucks, use Mozilla...
Marc Rémillard.
Re: moving particles [Re: Marky Mark] #148946
08/28/07 14:53
08/28/07 14:53
Joined: Aug 2005
Posts: 1,185
Ukraine
Lion_Ts Offline
Serious User
Lion_Ts  Offline
Serious User

Joined: Aug 2005
Posts: 1,185
Ukraine
take a look at the aum#26 for a snippet


Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1