# Getting face normal

 02 February 2004 BarbaPappa Frequenter Getting face normal 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? thanks share quote
 02 February 2004 rendermaniac . Simon Bunker Shader Writer / TD Australia Don't know if this is any help, but it goes into getting normals from MEL and was pretty useful for me. http://www.ewertb.com/maya/mel/mel.php?howto=05 Simon __________________ http://www.rendermania.com/ share quote
 02 February 2004 BarbaPappa Frequenter Thanks! 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 ) { vector \$normal; float \$x; float \$y; float \$z; string \$tokens[]; int \$numTokens = `tokenize \$pin " " \$tokens`; // Make sure we're looking at polyInfo data: if ( ( \$numTokens > 3 ) && ( \$tokens[0] == "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. return \$normal; } gonna try it out... thanks again share quote
 01 January 2006 CGTalk Moderation Expert Thread automatically closed 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. __________________ CGTalk Policy/Legalities Note that as CGTalk Members, you agree to the terms and conditions of using this website. share quote

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts vB code is On Smilies are On [IMG] code is On HTML code is Off CGSociety Society of Digital Artists www.cgsociety.org Powered by vBulletinCopyright ©2000 - 2006, Jelsoft Enterprises Ltd.