picking ?


#1

Writing plugin in maya.
When i click on the perspective view(top, front,… ect.), what i want is that i want to click on the point on the nurbs surface, so what class will help me to get that point (pick it up) for then i will get the normal, for instance, of the surface at that point. :slight_smile:


#2

Here some hints, perhaps of some help …

To get worldspace coordinates from view coordinates:

MStatus M3dView:: viewToWorld ( short x_pos, short y_pos, MPoint & nearClipPt, MPoint & farClipPt ) const

Use the current camera to get a reference to the current viewport (M3dView).
Then you will probably have to select a nurbs surface that you want to be “pickable”.
Then use the MFnNurbsSurface function set with some of its methods: closestPoint, isPointOnSurface, getParamAtPoint …

Then you could use

MVector MFnNurbsSurface:: normal ( double paramInU, double paramInV, MSpace::Space space, MStatus * ReturnStatus ) const

to extract the normal …
Hope this helps you a little even if it is not a complete solution …

-mk-


#3

it’s very good, thank you for reply mk
:slight_smile:


#4

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.