Hi,

The method getPolygonNormal will return a vector not a rotation, so you 
will need to either do some vector math to get the euler rotation from the 
vector using the position at the centre of the face and the normal vector 
to start with or maybe use an aimConstraint to align your cone along the 
vector.

This should help:

http://www.chrisevans3d.com/pub_blog/maya-python-vector-math-primer/


On Wednesday, 7 November 2018 03:18:10 UTC, Fleming Lin wrote:
>
> hi guys...I have done many research online and still can't figure out 
> where I did wrong....all I want...is just create one angry puffer fish( or 
> "sphere")...please help...
>
> ...so my first idea was to collect all the facial normal using 
> MItMeshPolygon.getPolygonNormal(( 
> faceIter.index(), om.MSpace.kWorld)) and then set both the position and 
> rotation base on the normal I got...but here is what I get....(see code and 
> result attach below). And I noticed that after I moved the sphere, the 
> "thorns" would remained at the origin instead of translated with the 
> sphere..... So I then use the om.MItMeshPolygon.center(om.MSpace.kWorld) to 
> get the center position of the face for the translation and normal for the 
> rotation...  Now I get the position right..but still the wrong 
> rotation....what should I do now? : <
>
> [image: Screen Shot 2018-11-06 at 9.57.11 PM.png]
>
> [image: Screen Shot 2018-11-06 at 9.58.57 PM.png]
>
> [image: Screen Shot 2018-11-06 at 9.59.14 PM.png]
>
>
> changed I made
>
> [image: Screen Shot 2018-11-06 at 10.15.52 PM.png]
>
> [image: Screen Shot 2018-11-06 at 10.14.59 PM.png]
>
>
>
>
>
> any help would be ultra appreciated!!! 
>

-- 
*MILK <http://www.milk-vfx.com/>** VISUAL EFFECTS**
*

Threeways House,





40-44 Clipstone Street London, W1W 5DW

Tel: *+44 (0)20 3697 8448*

* *


This message is intended solely for the addressee and may contain 
confidential and/or legally privileged information. Any use, disclosure or 
reproduction without the sender’s explicit consent is unauthorized and may 
be unlawful. If you have received this message in error, please notify Milk 
VFX immediately and permanently delete it. Any views or opinions expressed 
in this message are solely those of the author and do not necessarily 
represent those of Milk VFX. 

By engaging in professional correspondence 
with Milk VFX, we may store your contact information for future reference. 
This is in line with Milk’s Privacy policy which can be found here. 
<http://www.milk-vfx.com/wp-content/uploads/2018/05/Milk-VFX-Privacy-Policy-May-2018.pdf>
 
Milk Visual Effects is a registered limited company: 0844 1256. The 
registered company address is Threeways House, 40-44 Clipstone Street, 
London, W1W 5DW.

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/0fac14b0-c1fb-4565-aa62-0091a806c553%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to