list particle id while runtime?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Display Modes
  05 May 2010
list particle id while runtime?

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 May 2010
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.
"I love deadlines. I like the whooshing sound they make as they fly by" - Douglas Adams -
  05 May 2010
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.

  05 May 2010
Thread automatically closed

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.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 12:45 AM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.