Monday 12 July 2010

modified locator -to- particle script... useful!

 Note to self - figure out why counter caps at 100?

// Nulls2Particles Script by Garry Runke

string $selection[] = `ls -sl`;                            // `ls -sl` = list selected, creates an array with all selected objectnames in it

float $counter = `particle -q -count $selection[0]`;    // Get the number of particles

for ($x=0; $x<$counter; $x++)                           // Schleife läuft sooft wie Partikelanzahl
{

    string $part = $selection[0]+".pt["+$x+"]";             // This line builds the string representing the current particle (important for the next line)
    spaceLocator;        // Creates a locator at position 0 0 0
for($i=0; $i<200; $i++)
{    currentTime $i;
    float $partPos[2] = `getParticleAttr -at worldPosition $part`;    // Get the coordinates for each particle
    move -a  $partPos[0] $partPos[1] $partPos[2];            // Moves the locators over the particles
    setKeyframe;
}
};