Hey there,

“ ‘Point’ Specifies the location for which to evaluate the closest point on the 
mesh. `point' is transformed using the matrix parameter passed to the create() 
method, so for example if your matrix maps world to object space, then `point' 
should be specified in world space.”

You should either pass the cube’s world matrix on creation or pass the point 
localized to the cube’s space on get closest point.

Since you created the MMeshIntercector without passing a matrix to it the get 
closest point function expects a localized position.

That’s why you are getting a “random” point instead of the closest point to 
locator2.

If you pass the cube’s world matrix to the create just multiply the result of 
the get closest point by the same matrix and your locator will snap to the 
expected place.

Or you can keep create the way it is and multiply the point by the inverse of 
the cube’s world matrix before passing it to the get closest point and then 
multiply the result by the world matrix again.

Cheers,

Luiz

-- 
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/82d9cdd0-b19f-4da4-b36d-883ef7f86deb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to