is this true?
have to capture each element of the array to its own vector to be able to access the vectors elements?
vector $frog = $toad[5];
$tadpole = $frog.x;
not quite sure what you're getting at, but you could do this:
$frog = ($toad[7]+".x");
No, that doesn't work, and I'm kind of glad, because if it did then I would be pulling my hair out trying to figure out why. If I do this:
vector $test[3];
$test[0] = <>;
float $blah = ($test[0] + ".y");
I get the result:
// Warning: line 1: converting string "1 3" to a float value of 1. //
// Result: 1 //
Yes, unfortunately you have to assign the element of the array to a vector variable before you can use the .x, .y, or .z syntax.
-- Mark
Hmmm....I don't seem to have much trouble with it. Here is a snippet of code from one of my scripts...
$vertRGB = `polyColorPerVertex -q -rgb`;
float $vertR = $vertRGB[0];
float $vertG = $vertRGB[1];
float $vertB = $vertRGB[2];
$toad = `rgb\_to\_hsv <>`;
$frog = `rgb\_to\_hsv <>`;
float $hToadComponent = $toad.x;
float $sToadComponent = $toad.y;
float $vToadComponent = $toad.z;
float $hFrogComponent = $frog.x;
float $sFrogComponent = $frog.y;
float $vFrogComponent = $frog.z;
$hFrogComponent = $hToadComponent;
$chimp = `hsv\_to\_rgb <>`;
$rvalue = $chimp.x;
$gvalue = $chimp.y;
$bvalue = $chimp.z;
...?
-bN
Bent:
You're not doing what I was doing. Everything in your example script should work fine... it was trying to use $myvar[4].x or ($myvar[4] + ".x") that failed. You didn't do either of those. ![]()
-- Mark
yeah, put in words, i was asking:
why cant you pull out a component of a vector from w/i an array of vectors?
i understand now that it is a bit of a special case for going about addressing something. nonetheless, you should, for intuition's/consistancy's sake, be able to do this.
instead:
vector $toad[];
vector $frog = $toad[7];
$component = $frog.y;