PDA

View Full Version : Using pointPosition


Meecho
04-05-2007, 12:22 PM
I stored a name of the selected object using-
string surfaceName[] = `ls -sl -o`;

then later on in my script, i wanted to store the position of a random vertex on that object mentioned before using pointPosition -
float $vertPos[] = `pointPosition $surfaceName.vtx[$randomNum]`;

However it returns with,
"Error: Too many arguments. Expected 1, found 2"

I know it has something to do with using $surfaceName as it works if i type the actual name of the object instead. But i need to be able to use this script with any name.

Any ideas?

Thankyou

mhovland
04-05-2007, 01:23 PM
You need to catenate the data stored in the variables together int one string, like this:


float $vertPos[] = `pointPosition ($surfaceName+".vtx["+$randomNum+"]")`;


Try that out.

Meecho
04-05-2007, 01:58 PM
when i use that, it returns

" Error: Illegal operation "+" on data type string[]. "

GennadiyKorol
04-05-2007, 04:09 PM
$surfaceName is an array, you want to concatenate to some string in that array. To do that you'd need to index it:

float $vertPos[] = `pointPosition ($surfaceName[0]+".vtx["+$randomNum+"]")`;

Meecho
04-05-2007, 09:25 PM
Thankyou very much, that works fine :D

CGTalk Moderation
04-05-2007, 09:25 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.