How to link polyNormalPerVertex with a locator orientation ?

55 views
Skip to first unread message

francois...@gmail.com

unread,
Nov 29, 2018, 8:45:30 AM11/29/18
to Python Programming for Autodesk Maya
Hello there

I got the normals vertex with:


cmds.select( ** my vertex **, r=True )
resultNormalVertex=cmds.polyNormalPerVertex( query=True, xyz=True )


Result -> [0.9876886606216431, 0.0, -0.15643233060836792] which I guess is a vector.

I create a locator at the same vertex position, but would like also to have a correct orientation based on the vertex normals.

What would be the right python command for that ?

Marcus Ottosson

unread,
Nov 29, 2018, 4:07:02 PM11/29/18
to python_in...@googlegroups.com
One way of getting an orientation from that, is by creating locator A at that point, locator B at the origin, and aim constrain B to A. Then B will contain one (of many possible) orientations for that vector. If you like math, you can also have a look at (pun!) calculating the orientation from three points; that vector, the origin and an "up vector", for example (0, 1, 0). In OpenGL, such an operation is called "look at" and is what the aim constraint is doing too.

--
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/c45e3da3-e3e2-431d-bcf8-2b804456602a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages