View Full Version : list particle id while runtime?

05-12-2010, 11:43 AM
hi there,

I am trying to list the particle ids of a certain position in an array so I can kill them at a specified frame. But if I want to access the array it ends up in an infinity loop.
What am I doing wrong?


int $currentFrame = frame;
vector $pos= particleShape1.position;
int $pi;
int $IdList[];
int $IdListRemove[];
int $count = 0;
int $go = 1;

//list ids
if($pos.x < locatorKill.translateX && $pos.x > locatorKill.translateX - 0.01 && $go == 1){

$pi = particleShape1.particleId;
$count = size($IdList);

if ($pi != $IdList[$count]){
$IdList[$count] = $pi;

// kill particles at frame 1100
if ($currentFrame == 1100 && $go == 1){
$IdListRemove = $IdList;
$go = 0;

for ($i = 0; $i < $size; $i++){
particle -e -at lifespanPP -id $IdListRemove[$i] -fv 0 particle1;



05-12-2010, 01:29 PM
First, where do you declare/ define $size?

Next...wouldn't it be easier to do it the following way (pseudomelcode):

//only execute script on frame 1000
if($frame == 1000)
float $minY = locatorKill.translateY;
float $minX = locatorKikk.translateX;

//go through your particles

float $pPos = myParticleShape1.position;

if(($pPos.x < $minX) && ($pPos.y < $minY))
myParticleShape1.lifespanPP = 0;

That should do it.

05-12-2010, 03:07 PM
thanks for the reply,

basically it worked, but then maya kept on complaining about some ids:

// Error: Could not find particle with id specified. Please check id value in the query command //

but it works for now if I just suck the particles out of the way with a goal instead of killing them.


CGTalk Moderation
05-12-2010, 03:07 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.