//realnumber array
float $O1[] = `pointPosition column.vtx[95]` ;
float $O2[] = `pointPosition ball.vtx[25]` ;
// x y z
vector $O1Vec = <<$O1[0],$O1[1],$O1[2]>>;
vector $O2Vec = <<$O2[0],$O2[1],$O2[2]>>;
vector $OrigDiff = $O1Vec - $O2Vec;
float $OrigDist = mag($OrigDiff);
setAttr "turbulenceField1.magnitude" 0;
for ($i=0;$i<500;$i++){
//realnumber array
float $N1[] = `pointPosition column.vtx[$i + 1]` ;
float $N2[] = `pointPosition ball.vtx[$i + 1]` ;
// x y z
vector $N1Vec = <<$N1[0],$N1[1],$N1[2]>>;
vector $N2Vec = <<$N2[0],$N2[1],$N2[2]>>;
vector $Diff = $N1Vec - $N2Vec;
float $DiffDist = mag($Diff);
//print("Current Difference: " + $DiffDist + "\n");
if ($DiffDist <>= 8.5) {
float $Accel = (cos (($DiffDist/$OrigDist)*1.000) * 3.14159) * -0.25;
setAttr "gravityField1.magnitude" $Accel;
setAttr "turbulenceField1.magnitude" 15;
//print ("Current Accel = " + $Accel + "\n");
}
else if ($DiffDist <>= 8.0) {
setAttr "gravityField1.magnitude" 0;
setAttr "turbulenceField1.magnitude" 0;
}
else if ($DiffDist < 8) {
select -r copyOfball ;
duplicate -n ("ball" + ($i)) -rr;
select -r copyOfball;
HideSelectedObjects;
duplicate -n ("column" + ($i)) column;
polyUnite -ch 1 -n ("combined" + ($i)) ("column" + ($i)) ("ball" + ($i));
duplicate -n ("sub") ("combined" + ($i));
delete column;
delete ("combined" + ($i));
rename "sub" "column";
//int $Face[] = `polyEvaluate -f column`;
for ($j=4;$j<23;$j= $j+6){
select -r column.f[$j];
print ("face " + $j);
select -tgl column.f[$j + 113];
print (" to face" + ($j + 113) + "\n");
//Bridge Face Script
//As copied from Maya bonus tools Script
string $selectedFaces[] = `filterExpand -sm 34 -ex 1`;
// get just outer edges of each selected area
ConvertSelectionToEdges;
string $edges[] = `ls -sl`;
select $selectedFaces;
ConvertSelectionToContainedEdges;
string $inEdges[] = `ls -sl`;
select $edges;
select -tgl $inEdges;
// save outer edges in a set since IDs may change when faces are deleted
string $edgeSet;
$edgeSet = `sets -name $edgeSet`;
// delete the faces and perform the bridge on the appropriate edges
delete $selectedFaces;
select -r $edgeSet;
polyBridgeEdge -ctp 1 -tp 0.25 -divisions 5;
// check if any of the selected edges are still border edges since
// this means the face was deleted but not used in the bridge
select -r $edgeSet;
string $outEdges[] = `ls -sl`;
int $borderFound = 0;
int $a = 0;
while($a < `size $outEdges` && ! $borderFound) {
select -r $outEdges[$a];
string $faces[] = `polyInfo -ef`;
string $buffer[];
$borderFound = `tokenize $faces[0] $buffer` < 4;
$a = $a + 1;
}
if ($borderFound) {
warning (uiRes("m_polyBridgeFaces.kWarningExtraFaces"));
}
// cleanup: re-select the edges and delete the set
select -r $outEdges;
delete $edgeSet;
}
for ($k=34;$k<53;$k= $k+6){
select -r column.f[$k];
print ("face " + $k);
select -tgl column.f[$k + 113];
print (" to face" + ($k + 113) + "\n");
//Bridge Face Script
//As copied from Maya bonus tools Script
string $selectedFaces[] = `filterExpand -sm 34 -ex 1`;
// get just outer edges of each selected area
ConvertSelectionToEdges;
string $edges[] = `ls -sl`;
select $selectedFaces;
ConvertSelectionToContainedEdges;
string $inEdges[] = `ls -sl`;
select $edges;
select -tgl $inEdges;
// save outer edges in a set since IDs may change when faces are deleted
string $edgeSet;
$edgeSet = `sets -name $edgeSet`;
// delete the faces and perform the bridge on the appropriate edges
delete $selectedFaces;
select -r $edgeSet;
polyBridgeEdge -ctp 1 -tp 0.25 -divisions 5;
// check if any of the selected edges are still border edges since
// this means the face was deleted but not used in the bridge
select -r $edgeSet;
string $outEdges[] = `ls -sl`;
int $borderFound = 0;
int $a = 0;
while($a < `size $outEdges` && ! $borderFound) {
select -r $outEdges[$a];
string $faces[] = `polyInfo -ef`;
string $buffer[];
$borderFound = `tokenize $faces[0] $buffer` < 4;
$a = $a + 1;
}
if ($borderFound) {
warning (uiRes("m_polyBridgeFaces.kWarningExtraFaces"));
}
// cleanup: re-select the edges and delete the set
select -r $outEdges;
//delete $edgeSet;
}
editDisplayLayerMembers -noRecurse result_geometry column;
break;
}
currentTime $i;
//setAttr -type "string" defaultRenderGlobals.imageFilePrefix ("playblast_"+$i);
playblast -fr $i -format image -fp 4 -orn 0 -cf ("column_" + $i);
}
polySmooth column.f[194:385];
select -r column.f[106:961];
sets -e -forceElement rampShader1SG;
ConvertSelectionToVertices;
lattice -divisions 4 4 4 -objectCentered true ;
soft -c ;
spring -noDuplicate false -wireframe true -wl 2 -useRestLengthPS false -rl 4 -s 1 -d .2 -sfw 1 -efw 1 ;
//select -r ffd2Lattice ;
//turbulence -pos 3.562295 0 5.532889 -m 5 -att 0 -f 1 -phaseX 0 -phaseY 0 -phaseZ 0 -noiseLevel 0 -noiseRatio 0.707 -mxd -1 -vsh none -vex 0 -vof 0 0 0 -vsw 360 -tsr 0.5 ;
//connectDynamic -f turbulenceField2 ffd2Lattice;
//play;
select -r ffd2Lattice ffd2LatticeParticle spring2 ;
HideSelectedObjects;
for ($l=343;$l<500;$l++){
//setAttr -type "string" defaultRenderGlobals.imageFilePrefix ("review_"+$l);
//render persp;
currentTime $l;
playblast -fr $l -format image -fp 4 -orn 0 -cf ("column_" + $l);
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment