MItMeshPolygon.getNormal() strange result?

36 views
Skip to first unread message

Rudi Hammad

unread,
Apr 27, 2021, 10:24:15 PM4/27/21
to Python Programming for Autodesk Maya

Hello,
I want to get the face normal of a polygon using the API. So tipically I get 3 vertices on a polygon, and to the cross vector, normalize, etc... but the MItMeshPolygon has a getNormal() method. So you give the id and an mvector to fill up and that is the normal polygon. Now this is what I don't get. Lets say you a one face plane and you rotate 90 degrees in X the vertices (not the transform). getNormal() returns the expected vector (0, 0, 1). However, if you rotate the transform 90 degrees  the result is (0, 1, 0) as if nothing happened.

I tried al the MSpace possible but they don't do anything as expected. So I am not sure of getNormal() is supposed to work.

Cheers

Rudi Hammad

unread,
Apr 27, 2021, 10:47:47 PM4/27/21
to Python Programming for Autodesk Maya
oh, never mind...the id is not the face id, it is the vertex id, that why the result where weird.
Isn't really anything as simple as passing a face and getting the normal? I know how to get eveything I need using vector operations but I thought that maybe there is a direct method hidden somewhere in the api.
Maybe not.

Rudi Hammad

unread,
Apr 28, 2021, 12:39:35 PM4/28/21
to Python Programming for Autodesk Maya
aaarhhhgggg....again, never mind...it is a simple as using MFnMesh getPolygonNormal method on worldspace. You can delete this thread if you want to.

João Victor

unread,
Apr 28, 2021, 3:04:52 PM4/28/21
to python_in...@googlegroups.com
No problem, Rudi! Feel free to post your doubts. Im working on a project with these functions, but just saw your thread now.

cheers!

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/90cf15d3-7608-48b9-9f4a-4dfcc494ad43n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages