PDA

View Full Version : Multiple emitter max count.


bartlebooth
03-17-2011, 06:52 PM
Hello.

I have 4 emitters linked together into one nParticle system. Each emitter emits a different sized and coloured nParticle. nParticles are goaled to four different curves (attached to the CV's of the curve). Now what I need is for each emitter to emit a specific number of nParticles for each curve (curve 1 - 20, curve 2 - 43, etc...). I can get nParticles to every CV point if I set the Max Count value to a high number but it is more than I need and I get an unwanted pulsing effect as nParticles emit on top of each other. Below is what I have so far in terms of expressions. Thank you.



//creation

if (nParticleShape1.emitterId == 0)

{

nParticleShape1.radiusPP = 1.7;

nParticleShape1.rgbPP = <<0,0,0>>;

nParticleShape1.goalWeight0PP = 1;

nParticleShape1.goalWeight1PP = 0;

nParticleShape1.goalWeight2PP = 0;

nParticleShape1.goalWeight3PP = 0;

}

if (nParticleShape1.emitterId == 1)

{

nParticleShape1.radiusPP = 1.2;

nParticleShape1.rgbPP = <<1,1,1>>;

nParticleShape1.goalWeight0PP = 0;

nParticleShape1.goalWeight1PP = 1;

nParticleShape1.goalWeight2PP = 0;

nParticleShape1.goalWeight3PP = 0;

}

if (nParticleShape1.emitterId == 2)

{

nParticleShape1.radiusPP = 1.52;

nParticleShape1.rgbPP = <<1,0,0>>;

nParticleShape1.goalWeight0PP = 0;

nParticleShape1.goalWeight1PP = 0;

nParticleShape1.goalWeight2PP = 1;

nParticleShape1.goalWeight3PP = 0;

}

if (nParticleShape1.emitterId == 3)

{

nParticleShape1.radiusPP = 1.55;

nParticleShape1.rgbPP = <<0,0,1>>;

nParticleShape1.goalWeight0PP = 0;

nParticleShape1.goalWeight1PP = 0;

nParticleShape1.goalWeight2PP = 0;

nParticleShape1.goalWeight3PP = 1;

}



Regards,
Bartlebooth.

eaclou
03-17-2011, 11:07 PM
I'm still kind of new to expressions, so take this with a grain of salt, but you could probably put in a line of code for each emitter checking the "count" attribute, and set all emitters to a very high rate. For example:


if (nParticleShape1.emitterId == 0)

{

if (nParticleShape1.count >= 20) {
emit1.rate = 0; //note* "rate" probably isn't the correct attribute name
}

nParticleShape1.radiusPP = 1.7;

nParticleShape1.rgbPP = <<0,0,0>>;

nParticleShape1.goalWeight0PP = 1;

nParticleShape1.goalWeight1PP = 0;

nParticleShape1.goalWeight2PP = 0;

nParticleShape1.goalWeight3PP = 0;

Or you could try setting each emitter to the rate you wish, i.e 1=20, 2=43, and keying them off after 1 second so they emit the correct amount of particles -- this isn't instant though.

Aikiman
03-18-2011, 12:12 AM
Forget what I said, I get it now, too early in the morning :)

Yes eaclou is on the right track.

bartlebooth
03-18-2011, 02:18 PM
Thanks eaclou, I appreciate the response. I will give this a try when I get the chance.

Bartlebooth.

CGTalk Moderation
03-18-2011, 02:18 PM
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.