ClosestPointOnMesh / NearestPointOnMesh

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Display Modes
  05 May 2008
ClosestPointOnMesh / NearestPointOnMesh

Hi Guys

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 May 2008
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
  05 May 2008
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)

-- David
  05 May 2008
Hi Guys

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 May 2008
Thread automatically closed

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.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 08:36 PM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.