View Full Version : ClosestPointOnMesh / NearestPointOnMesh
05-08-2008, 03:47 PM
Think i'm getting a little confused.
Ive got a script that uses ClosestPointOnMesh, when I run it I get the error "cannot find procedure", I've searched the help files and found some info on it so I assume it should be there....
But I've had a google for it and found that it appears to have been replaced with nearestPointOnMesh at some point.
So the question is, has closest been replaced with nearest? If so, I just need to alter the script, if not am I missing something??
I'm using Maya 2008
05-08-2008, 08:52 PM
yes you are right.
Maya comes with nearestPointOnMesh. Check if this plugin in loaded in the plugin manager.
Just try to change it in your script, maybe it works...;)
On the other Hand.... I think the Bonustools delivers the closestPoinOnMesh.mll
Since maya 8, closestPointOnMesh is included. Before that it was available as a bonustool.
But it is a node that you create, rather than a proceedure that you run. Maybe if you show us the code we could comment further.
For example here is one way how you can create and use the CPOM
// create closestPointOnMesh node
// and connect it to the polymesh
string $cpom = eval("createNode closestPointOnMesh -n cpom1");
connectAttr -f mySurface.outMesh ($cpom + ".inMesh");
// create a transform node
// and connect it to the closestPointOnMesh node
string $loc = eval("createNode transform -n loc1");
connectAttr -f ($loc + ".translate") ($cpom + ".inPosition");
// get the uv coords from the closestPointOnMesh node
float $fu = `getAttr ($cpom + ".u")`;
float $fv = `getAttr ($cpom + ".v")`;
So $fu and $fv will be the uv's on the surface that are closest to the $loc transform.
(I have extracted this from another script and editted it so I appologise in advance if I typed something wrong. Hopefully you can still get the meaning)
05-09-2008, 08:10 AM
Thanks for clearing that up, I thought it might be something that I have to create (as I saw something similar on an old thread) but as I then saw some comments saying closest has been superceeded with nearest in version 8 or 8.5 I want too sure.
I changed the script form closest to nearest and it works fine now, but I will definatly bear it in mind.
The codes from the Autodesk Modeling with Maths training DVD, which I think if I remember reading the release notes is for version 7??
Cheers for the help its much appreciated.
05-09-2008, 08:10 AM
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.
vBulletin v3.0.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.