Droolz
03-04-2008, 10:39 PM
Hey all,
I'm tring to animate some particles that have 4 goals, and I'd like the attracted particles to be fairly random. The creation expression looks like this:
baseParticleShape.mass = `rand 0.5 2.0`;
//set 'goal ID' for the particles - note rand is higher than number of goals, so approx 50% of particles have no goal weights assigned
baseParticleShape.userScalar1PP = floor(rand(8));
int $id=baseParticleShape.userScalar1PP;
//set all goals to void
baseParticleShape.goalWeight0PP =0;
baseParticleShape.goalWeight1PP =0;
baseParticleShape.goalWeight2PP =0;
baseParticleShape.goalWeight3PP =0;
if ($id==0){
baseParticleShape.goalWeight0PP=0.5;
}else if ($id==1){
baseParticleShape.goalWeight1PP=0.5;
}else if ($id==2){
baseParticleShape.goalWeight2PP=0.5;
}else if ($id==3){
baseParticleShape.goalWeight3PP=0.5;
}
The idea behind this is roughly 50% of the particles will get weighted to a goal, the others ignore the goals. The overall (non PP) goal weights are set to 1.
If you cut this:
if ($id==0){
baseParticleShape.goalWeight0PP=0.5;
}else if ($id==1){
baseParticleShape.goalWeight1PP=0.5;
}else if ($id==2){
baseParticleShape.goalWeight2PP=0.5;
}else if ($id==3){
baseParticleShape.goalWeight3PP=0.5;
}
Then you get the behavior of no goals, as expected. However with this code, *all* particles appear to be weighted. There are no 'loose' particles. Does anyone have any ideas why this is the case, no doubt something astoundingly obvious, but I appear to be having a perpetual brainfart.
Cheers, Jules
I'm tring to animate some particles that have 4 goals, and I'd like the attracted particles to be fairly random. The creation expression looks like this:
baseParticleShape.mass = `rand 0.5 2.0`;
//set 'goal ID' for the particles - note rand is higher than number of goals, so approx 50% of particles have no goal weights assigned
baseParticleShape.userScalar1PP = floor(rand(8));
int $id=baseParticleShape.userScalar1PP;
//set all goals to void
baseParticleShape.goalWeight0PP =0;
baseParticleShape.goalWeight1PP =0;
baseParticleShape.goalWeight2PP =0;
baseParticleShape.goalWeight3PP =0;
if ($id==0){
baseParticleShape.goalWeight0PP=0.5;
}else if ($id==1){
baseParticleShape.goalWeight1PP=0.5;
}else if ($id==2){
baseParticleShape.goalWeight2PP=0.5;
}else if ($id==3){
baseParticleShape.goalWeight3PP=0.5;
}
The idea behind this is roughly 50% of the particles will get weighted to a goal, the others ignore the goals. The overall (non PP) goal weights are set to 1.
If you cut this:
if ($id==0){
baseParticleShape.goalWeight0PP=0.5;
}else if ($id==1){
baseParticleShape.goalWeight1PP=0.5;
}else if ($id==2){
baseParticleShape.goalWeight2PP=0.5;
}else if ($id==3){
baseParticleShape.goalWeight3PP=0.5;
}
Then you get the behavior of no goals, as expected. However with this code, *all* particles appear to be weighted. There are no 'loose' particles. Does anyone have any ideas why this is the case, no doubt something astoundingly obvious, but I appear to be having a perpetual brainfart.
Cheers, Jules
