How to create chain in maya for a tank
proc Cmaker(){
if ( `window -exists CMaker` ) {
deleteUI CMaker;
}
$win=`window -t "Chain Maker" -w 258 -h 118 CMaker `;
columnLayout c1;
rowLayout -p c1 -nc 2 -w 250 -cw2 125 125 r1;
button -w 125 -p r1 -l "Sel Curve" -c selCurve slcurv;
button -w 125 -p r1 -l "Sel Chain Hook" -c selObj slhook;
intSliderGrp -l "Copies" -min 10 -max 1000 -fmn 10 -fmx 1000 -p c1 -v 10 -field true -cw3 50 40 10 numC;
button -w 250 -h 40 -p c1 -l "Create Chain" -c DupAlign;
showWindow CMaker;
}
proc selCurve(){
$sel=`ls -sl`;
$shp=`listRelatives -s $sel[0]`;
if((`nodeType $shp[0]`)==("nurbsCurve")){
button -e -l $sel[0] -w 125 slcurv;
}else{
warning "Selected Object is not a curve";
}}
proc selObj(){
$sel=`ls -sl`;
if(size($sel)>0){
button -e -l $sel[0] -w 125 slhook;}else{warning "please something atleast for godsake !!";}
}
proc DupAlign(){
string $curv;
float $offset,$ncopiess,$pos[];
string $obj,$dup[],$joint;
$ncopiess=`intSliderGrp -q -v numC`;
$curv=`button -q -l slcurv`;
$obj=`button -q -l slhook`;
$offset=1/$ncopiess;
select -d;
for($i=0;$i<$ncopiess;$i++){
$pos=`pointOnCurve -pr ($i*$offset) -p $curv`;
$joint=`joint -p $pos[0] $pos[1] $pos[2]`;
$dup=`duplicate -ilf $obj`;
move -a $pos[0] $pos[1] $pos[2] $dup[0];
parent $dup[0] $joint;
}
//ikHandle -sol ikSplineSolver -ccv false;
}
Cmaker;
No comments:
Post a Comment