Hey List, currently i try to develop a little CustomTool. Most of it works fine, except one annoying Issue.
I use the Pick-Command to get a current Location under my CursorAs demonstrated in the attached picture, when the cursor is near the Edge between Object and ViewportBackground there seems to be an Error.
Does anyone know how to avoid this?
in_ctxt.GetMousePosition( cursX, cursY ); CLongArray l_points; l_points.Add( cursX); l_points.Add( cursY ); CRefArray pickObjs; in_ctxt.Pick( l_points, siPickSingleObject, siPickRaycast, L"", CRefArray(), pickObjs ); if( pickObjs.GetCount() != 0 && X3DObject(pickObjs[0]).GetType() == L"polymsh" ) { // Try to get a Object CLine worldRay; in_ctxt.GetWorldRay(cursX, cursY, worldRay); CVector3 rayO = worldRay.GetOrigin(); CVector3 rayD = worldRay.GetTangent(); X3DObject pickObj(pickObjs[0]); PointLocatorData locs = pickObj.GetActivePrimitive().GetGeometry().GetRaycastIntersections(1, (double*)&rayO, (double*)&rayD, siSemiLineIntersection ); pickObj.GetActivePrimitive().GetGeometry().EvaluatePositions(locs, -1, 0, (double*)&worldPos); } else { in_ctxt.GetWorldPosition( cursX, cursY, worldPos ); }
<<attachment: LocUnderCursor_snap.jpg>>