Hello everybody,
I know this is mostly a Python forum, but I'm currently writing in C++ a
deformer,
dealing with curves yaay, hopefully it is ok nonetheless, otherwise I come
up with a python api example...
I have also looked through the forum and could find just a
MFnMesh.closestPoint issue, which does not really help me unfortunately.
My maya setup is as follows:
- I have an ep curve degree=3
- I want to affect a polyCylinder with the curve, like the wireTool
- As a current idea, one of the steps to achieve that is to get the
closestPoint and param on the curve for each Vertex on my polyCylinder.
- For that I use MFnNurbsCurve closestPoint, but when I'm cout position and
param values,
they are mostly zeroed out and when I'm in component mode selecting the
vertices of the mesh and move them down in ty
I get a bunch of value changes, but only when I'm less then 0, everything
above stays 0 (position and param values)
- Here is the code:
// Inside the deform method
//Get the closestPoint and param on the curve from each vertex
MFnNurbsCurve fnCurve(oCurve); //Assume we have the MObject of the
curve already
double param;
MPoint position;
for (;! iter.isDone(); iter.next())
{
//Helper method to retrieve/store the position and param value on
the curve
getClosestPoint(fnCurve, iter.position(), position, param);
cout << "index: " << iter.index() << " point: " << position.x << " "
<< position.y << " " << position.z << " param: " << param << endl;
}
void Curve::getClosestPoint(MFnNurbsCurve& fnCurve, MPoint inPosition,
MPoint& position, double& param)
{
position = fnCurve.closestPoint(inPosition, ¶m, 0.0, MSpace::kWorld
);
}
This is basically a part from the closestPoint/TangentAndDistance.cpp
source file.
But for any kind of reason, I don't get proper values... am I missing
something?
Thanks in advance!
Emre
--
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/ca5a52a6-b4a0-47d0-ae65-675112ece94a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.