Could store the vertices in an array then do a random number (believe the command is rand) and access the array with the random number. A quick way to check would be to store the vertices used in another array and see if the two match up, if not make tree else generate new number. You could also do this without a plane (as…
In the loop you're placing trees, each time you place a tree you add it to the array. Next time you add a tree you're checking the array if it's already in there, if not place it. :)
Edit* haiddasalami beat me to it. :) gilesruscoe >> This line is wrong: $vertexList[size($vertexList)] = `pointPosition pPlane1.vtx[$randomNumber1]`; You're trying to store a position to a float array. In this case you would want a vector array or remember the vertices by index. mccartm6 >> It's absolutely doable but it…
int $vertCount[] = `polyEvaluate -v $placementHelper`; polyEvaluate returns an array so you need to make the variable an array. Also watch the closing of tilda's. That's why there's a syntax error and on another note, dont assume the mesh will be selected always, I know you're making it in the script etc. This is more of a…
Storing the names in an array is a good way of being able to repeat the same action with a for loop instead of copy-paste the same action for each reference. :)
you could just store the vertex positions that you have used something like //OUTSIDE OF FOR LOOP//float $vertexList[];//Inside FOR LOOP//$vertexList[size($vertexList)] = pPlane1.vtx[$randomNumber1]; Sucks that mel doesnt have push/pop or any array methods so this is a quick way to do a push. PS: I havent tested this, so…
Wow, thanks so much for that! So by making a global proc, everything within it becomes global too, so to speak? How did i not figure that out... ha. That's made things a lot clearer and easier to understand. Glad that the vertex counter is working now too. I'l try to get a rand with a max value of the vertex count working…
K so the reason is you're first missing the open and close brackets for the for loop. Second the move command wants the object name at the end. Otherwise the script will just error out. Here's the fixed up code: for( $i=0; $i<$density; $i++ ) { string $tree[] = `polyCube -name ("treeA"+$i)`; int $randomNumber1 = `rand…
Ah right, so you have to store the coords in a float array and then seperately call out each number stored in it. Gotcha! Thanks a ton for the working code. That part works now. While i was having trouble with that i started on the percentage sliders. I'm having trouble getting this to work: intSliderGrp -label "Oak…