View Full Version : Getting face normal
02 February 2004, 10:03 PM
I'm trying to get the normal of a face. The way i'm doing it now gives me a string. Instead of getting it as a string i would like to get it as a vector variable or to be able to easily convert it to a vector. Here's what i currently do:
polyInfo -faceNormals $selection;
// Result: FACE_NORMAL 43: 0.171929 -0.000000 -0.985109 //
Is there an easy way to get the normal vector of a face? Or is there an easy way to convert this string into a vector variable?
02 February 2004, 01:11 AM
Don't know if this is any help, but it goes into getting normals from MEL and was pretty useful for me.
02 February 2004, 08:31 AM
I found this little script to help me get a vector of the string i talked about in my last post:
proc vector translatePolyInfoNormal( string $pin )
int $numTokens = `tokenize $pin " " $tokens`;
// Make sure we're looking at polyInfo data:
if ( ( $numTokens > 3 ) && ( $tokens == "FACE_NORMAL" ) )
// Maya performs data-type conversion here.
$x = ($tokens[$numTokens-3]);
$y = ($tokens[$numTokens-2]);
$z = ($tokens[$numTokens-1]);
$normal = << $x, $y, $z >>;
// Normalize it.
$normal = `unit $normal`;
// Return it.
gonna try it out... thanks again
01 January 2006, 09:00 AM
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.