This is my second melscript revision. It essentially does the same thing as the last one, but it adjusts the bend resistance and lift over time with an expression, in order to give a more leafy quality.
//Clean Up
SelectAll;
doDelete;
// User Definitions
string $currentSelection[];
string $myTurbulence[];
string $myAir[];
//Set Up Background
polyPlane -w 1 -h 1 -sx 1 -sy 1 -ax 0 1 0 -cuv 2 -ch 1;
move -2.076 -4.896 7.866;
rotate 0 0 90;
scale 9 1 16;
sets -e -forceElement surfaceShader1SG;
$currentSelection = `ls -selection`;
select -r (($currentSelection[0]) + ".map[0:3]");
polyEditUV -pu 0.5 -pv 0.5 -a 90 ;
polyEditUV -pu 0.5 -pv 0.5 -su -1 -sv 1 ;
//Create Fields
turbulence -pos 0 0 0 -m 6 -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 ;
$myTurbulence = `ls -selection`;
air -pos 0 0 0 -m 15 -att 0 -dx 0 -dy -.75 -dz 1 -s 5 -iv 1 -iro 1 -vco 0 -es 0 -mxd 20 -vsh none -vex 0 -vof 0 0 0 -vsw 360 -tsr 0.5 ;
$myAir = `ls -selection`;
//Create petals For Loop
for( $i=0; $i<10; $i++)
{
//create plane
polyPlane -w .25 -h .5 -sx 10 -sy 10 -ax 0 1 0 -cuv 2 -ch 1;
move -r (rand(-1,1)) (rand(-1,1)) (rand(-1,1));
rotate (rand(0,360)) (rand(0,360)) (rand(0,360));
sets -e -forceElement flowerPetalTexture2SG;
//Adjust NCloth settings
createNCloth 0;
$currentSelection = `ls -selection`;
setAttr (($currentSelection[0]) + ".drag") (rand(.05, 5));
setAttr (($currentSelection[0]) + ".pointMass") (rand(.1, 2));
setAttr (($currentSelection[0]) + ".lift") (rand(.1, 2));
setAttr (($currentSelection[0]) + ".bendResistance") 10;
setAttr (($currentSelection[0]) + ".stretchResistance") (rand(1, 200));
expression -string (($currentSelection[0]) + ".drag = (rand(.05, 5)); \n" + ($currentSelection[0]) + ".pointMass = (rand(.1, 2)); \n" + ($currentSelection[0]) + ".lift = (rand(.1,2)); \n");
//Attach Fields
connectDynamic -f $myAir $currentSelection;
connectDynamic -f $myTurbulence $currentSelection;
select -r $currentSelection nucleus1 ;
setAttr "nucleus1.gravity" 0;
}
No comments:
Post a Comment