doppelganger
07-28-2003, 12:02 AM
Regards all,
I am working on a mel script to generate a row of pikes (spears) in a castle scene. I would like the script to constrain the pikes to a curve as it duplicates them so the user can draw the curve then execute the script and the pikes are generated along that path. I am at a loss tho. Here is what I have so far, any suggestions on how to achive what i am looking for?
Thanks
Scott
///////////////////////////////////////////////////////////////////////
// ss_pikes.mel //
// scott spencer //
// 7/27/03 //
// //
// generates a row of pikes and tilts them in x and y //
//////////////////////////////////////////////////////////////////////
//declare variables for the rotate x and y values
int $pike_count = 0;
//create cone
polyCone -r 1 -h 2 -sx 3 -sy 1 -sz 0 -ax 0 1 0 -tx 1 -ch 1;
//scale into shape of pike
scale -r .088 10.001 .076;
//move pivot to base of pike
xform -ws -piv 0 -10 0;
//move pike to groundplane
move -rpr -y 0;
seed (1);
do {
float $rotx = `rand 0 78`;
float $roty = `rand -30 30`;
float $trans = `rand .5`;
//duplicate with random xy transform
duplicate -rr; move -r 1;
//get selected objects tx value and add it to the tx of the next
//pike generated
//rotate in the x and y axes to tilt forward and to side
rotate -ws $rotx $roty 0;
//add one to $pike_count
$pike_count ++;
}
while ($pike_count < 100);
I am working on a mel script to generate a row of pikes (spears) in a castle scene. I would like the script to constrain the pikes to a curve as it duplicates them so the user can draw the curve then execute the script and the pikes are generated along that path. I am at a loss tho. Here is what I have so far, any suggestions on how to achive what i am looking for?
Thanks
Scott
///////////////////////////////////////////////////////////////////////
// ss_pikes.mel //
// scott spencer //
// 7/27/03 //
// //
// generates a row of pikes and tilts them in x and y //
//////////////////////////////////////////////////////////////////////
//declare variables for the rotate x and y values
int $pike_count = 0;
//create cone
polyCone -r 1 -h 2 -sx 3 -sy 1 -sz 0 -ax 0 1 0 -tx 1 -ch 1;
//scale into shape of pike
scale -r .088 10.001 .076;
//move pivot to base of pike
xform -ws -piv 0 -10 0;
//move pike to groundplane
move -rpr -y 0;
seed (1);
do {
float $rotx = `rand 0 78`;
float $roty = `rand -30 30`;
float $trans = `rand .5`;
//duplicate with random xy transform
duplicate -rr; move -r 1;
//get selected objects tx value and add it to the tx of the next
//pike generated
//rotate in the x and y axes to tilt forward and to side
rotate -ws $rotx $roty 0;
//add one to $pike_count
$pike_count ++;
}
while ($pike_count < 100);
