H3ro

05 May 2006, 11:27 PM

Hi, I know that I have asked a question which is almost like this one, but maybe this one is harder or that I dont get the consept.

Could anyone please take a look at it and tell me what is worng?

(Btw, I am trying to create a mel script which creates a pinboard)

Thanks in advance

---

{

//for test

file -f -new;

//create the plane, and specify the size of it

//scale

float $scaleX = 10;

float $scaleZ = 10;

//resolution

float $resX = 10;

float $resZ = 10;

string $plane[] =`polyPlane -width $scaleX

-height $scaleZ

-subdivisionsWidth $resX

-subdivisionsHeight $resZ

-ax 0 1 0

-tx 1

-ch 1`;

//find out how many vertex there are on the plane

int $noVert[] = `polyEvaluate -vertex $plane[0]`;

//create the emitter and particleShape

string $emitter[] =`emitter -pos 0 0 0

-type omni

-r 10000

-sro 0

-nuv 0

-cye none

-cyi 1

-spd 1

-srn 0

-nsp 1

-tsp 0

-mxd 0

-mnd 0

-dx 1

-dy 0

-dz 0

-sp 0` ;

string $particl[] = `particle`;

connectDynamic -em $emitter[0] $particl[0];

//modefy the emitter

setAttr ($particl[0]+".conserve") 0;

setAttr ($particl[0]+".maxCount") $noVert[0];

//create a collision event

event -die 0 -count 0 -name PinBoard $particl[0];

//create the expression

dynExpression -s (

"int $noPart = "+ $noVert[0] +";

int $i = 0;

if ("+ $particl[0] +".eventCount[0] > 0)

{

while ($noPart > $i)

{

vector $pos = "+ $particl[0] +".position;

vector $posVert = `xform -q -ws -t "+ $plane[0] +".vtx[$i]`;

if ("+ $particl[0] +".id == ($i))

{

"+ $particl[0] +".position = <<$posVert.x,$pos.y,$posVert.z>>;

}

$i++;

}

}"

)

-rad $particl[0];

}

Could anyone please take a look at it and tell me what is worng?

(Btw, I am trying to create a mel script which creates a pinboard)

Thanks in advance

---

{

//for test

file -f -new;

//create the plane, and specify the size of it

//scale

float $scaleX = 10;

float $scaleZ = 10;

//resolution

float $resX = 10;

float $resZ = 10;

string $plane[] =`polyPlane -width $scaleX

-height $scaleZ

-subdivisionsWidth $resX

-subdivisionsHeight $resZ

-ax 0 1 0

-tx 1

-ch 1`;

//find out how many vertex there are on the plane

int $noVert[] = `polyEvaluate -vertex $plane[0]`;

//create the emitter and particleShape

string $emitter[] =`emitter -pos 0 0 0

-type omni

-r 10000

-sro 0

-nuv 0

-cye none

-cyi 1

-spd 1

-srn 0

-nsp 1

-tsp 0

-mxd 0

-mnd 0

-dx 1

-dy 0

-dz 0

-sp 0` ;

string $particl[] = `particle`;

connectDynamic -em $emitter[0] $particl[0];

//modefy the emitter

setAttr ($particl[0]+".conserve") 0;

setAttr ($particl[0]+".maxCount") $noVert[0];

//create a collision event

event -die 0 -count 0 -name PinBoard $particl[0];

//create the expression

dynExpression -s (

"int $noPart = "+ $noVert[0] +";

int $i = 0;

if ("+ $particl[0] +".eventCount[0] > 0)

{

while ($noPart > $i)

{

vector $pos = "+ $particl[0] +".position;

vector $posVert = `xform -q -ws -t "+ $plane[0] +".vtx[$i]`;

if ("+ $particl[0] +".id == ($i))

{

"+ $particl[0] +".position = <<$posVert.x,$pos.y,$posVert.z>>;

}

$i++;

}

}"

)

-rad $particl[0];

}