View Full Version : create new particles when existing particle dies without collision

02 February 2008, 08:18 AM
hi there, i am setting up a shot where i would have bunch of instanced object falling down... i would like to replace the object with another another object to create a some sort of popping effect like magically transfrom from object A to B. Object B;s scale will be animated and some magic dusts effects will be added to make it more natural instead of an akward pop..

so... here is how i figured how i do it....

1)first i will create my desired simulation.. making the object rotate and fall correctly.
2) set up a desired random range lifespan...
3) Create a mel to create a particle once the current one dies.
4) instance the new particles with my new object.
5) make the new object inherit rotation, velocity etc.

so what to you guys think of this work flow?... is there other better methods to make this scene?
i'm currently stuck on step 3. i'm couldn;t figured out a script for it. I;m fairly new in Mel, I hope some of you guys can give me some tips on coding this.

Something i just thought of while i;m typing this thread. Should i use Object index? Do i have to make a sequenced object to do so or just a regular keyframed object? i use a mel to morph from object [0] to a sequence of [1]2[3][4][5][6]?. i gotta figure out how to drive the thing with the the rand function?

i think i have the general idea of it.. perhaps still lack of scripting expierience to put things together... soo anyone care to help the lost soul ?


02 February 2008, 10:52 PM
There are a couple of ways to you could do this. If you want the particle1 to die and create a new particle shape then you could select particle1 and emit from object. Then on the new emitter you can set it to have a per-point emission rate (under the particle menu) which will create a new attr on particle1 called like emitterRatePP or something. Then in the run time for that you could say something like:

if (particleShape1.age > 1.9 && particleShape1.age < 2)
particleShape1.emitter2RatePP = 20;

So if your particle1 lifespan is set to 2, just before it dies it will emit a new particle which could then be your new object.

Another option is like what you said. Lets say you have 3 different objects for objA and 3 others for objB. You could instance all those objects to your particle (selecting the objects in order you want them...all 3 for objA first then all in objB). Then create a custom index attr (example: objIndex) with a creation expression that sets the objectInstance to a rand(0,2). So at birth it will be one of the 3 objects that make up objA. Then in the runtime expression for that attr you could do something similar to the above and at a certain age you could set the index attr to one of the objects in objB (3-5). And if you want the first object in objA to always change to the first one in objB you could do something like this:

if (particleShape1.age > 2)
if (particleShape1.objIndex == 0)
particleShape1.objIndex = 3;

So once the particles age is greater the 2 seconds the instance object will switch from your first instanced object to your 4th. Hope all this makes sense and helps.


02 February 2008, 02:41 AM
Hi there, thanks for the help!.. i was fiddling with the idea of particle age too!! i think it makes more sense now.

what if :

$randAge = rand (1.2,2)
particleShape1.lifespanPP= $randAge

if (particleShape1.age > $randAge)
if (particleShape1.objIndex == 0)
particleShape1.objIndex = 3;

then on runtime:

if (particleShape1.objIndex >= 3 && particleShape1.objIndex <11) {
particleShape1.objIndex +=1

i was wondering will it work this way... ? Will the changing be randomised ? i read about ageNormalised too... perhaps i can try to use that attribute?

will it play my sequence if i have sequenced object 3,4,5,6,7,8,9,10 with the runtime expression?

i will go try out some of these ideas....
thanks for the help!

CGTalk Moderation
02 February 2008, 02:42 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.