Storm Keeper Posted October 25, 2014 Share Posted October 25, 2014 (edited) Hello everyone! Inspired by this topic (http://forums.odforce.net/topic/12691-closest-point-on-the-primitive/) I've been trying to implement HDK function similar to VEX xyzdist using GU_RayIntersect class and its minumumPoint() method .Unfortunately, it always gives me zero values for uv. Tried it with different objects, no luck. Does anyone know how to make it right? OP_ERROR SOP_xyzdist::cookMySop(OP_Context &context) { if (lockInputs(context) >= UT_ERROR_ABORT) return error(); duplicateSource(0, context); UT_Vector3 pos(0,0,0); // just for testing GA_PrimitiveGroup* grp = 0; // Searching the whole geometry, I suppose GU_MinInfo mininfo(0, 100000, 1); GU_RayIntersect near(gdp, grp, 1); near.minimumPoint(pos, mininfo); float u = mininfo.u1; float v = mininfo.v1; std::cout << u << " " << v << std::endl; unlockInputs(); return error(); } Edited October 25, 2014 by Dmitry Shurov Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.