PDA

View Full Version : Arrays and Per-Vertex Operations.


mental
02-26-2008, 05:30 AM
Hey guys,

I have a polygonal surface with 6000 vertices. On a per-vertex basis I am trying to:

1) Create a cluster per vertex.
2) Attach an emitter using the Emit From Object command (not the usual create emitter operation).

I put together the following script but the trouble is that an emitter will only be applied to the first vertex in the list while the subsequent vertices throw this error:

// Warning: Selected object cannot own a field/emitter/collision. Object must be a surface, mesh, or (for fields or emitters) particle object. //
I'm not sure why the script quits out of the array. Perhaps it is a specific issue working with vertices?

Script (select random vertices on a polygonal object and run):

string $selectedPoints[] = `ls -sl -fl`;
string $currentPoint;

for ($currentPoint in $selectedPoints)

{
EmitFromObject;
}
I'm stumped :sad:

Any help would greatly be appreciated!

Thanks.
-mental :surprised

NPuetz
02-26-2008, 07:06 AM
As far as why it quits out the array like that.....im not so sure, but here is another way around that problem. Hope this helps.....

string $selectedPoints[] = `ls -fl -sl`;
string $currentPoint;

for ($i=0;$i<(size($selectedPoints));$i++)

{
select $selectedPoints[$i];
EmitFromObject;
}

mental
02-26-2008, 04:56 PM
Works perfectly! Thank you very much for you help Nicklas. You've saved me quite a bit of time :)

NPuetz
02-26-2008, 09:28 PM
No problem man, glad i could help :)

CGTalk Moderation
02-26-2008, 09:28 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.