Hi, I am calling the MFnNurbsSurface.intersect() method and for the life of me I can't get it to work.
It is not creating the values and to complicate things, the return boolean is false, but the MStatus variable returns kSuccess.
//first I connect the surface.worldSpace[0] to intersectionNode.collisionSurface
//this is how I created the attr
MStatus stat;
aInSurface = surfaceAttr.create("collisionSurface", "cs", MFndata::kNurbsSurface, &stat);
//I checked the validity of the surface and its MFnNurbsSurface function set
MFnNurbsSurface surfaceFn (inSurfaceObj, &stat);
//this is how I created the variables
MPoint rayOrigin = MPoint(3.0, 3.0, 0.0);
MVector rayDirection = ( 0.0, -1.0, 0.0);
double uParam;
double vParam;
MPoint intersectionPos;
double distance;
bool result;
//then I call the method
result = surfaceFn.intersect( rayOrigin, rayDirection, uParam, vParam,
intersectionPos, kMFnNurbsEpsilon, MSpace::kWorld,
true, //calculate distance
distance, false, //calculate exact hit
NULL, &stat);
//the [out] variables remain unchanged and the error checking is conflicting
//this prints out: INTERSECTION!!!
if(result)
cout<< "INTERSECTION!!!";
else
cout<< "NOTHING HAPPENED.";
//this prints out: NOTHING HAPPENED
if(stat == MStatus::kSuccess)
cout<< "INTERSECTION!!!";
else
cout<< "NOTHING HAPPENED.";
What could be going wrong?