RE: CustomTool Pick
Hi Vincent, The first place to start is by checking the return values to make sure the calls succeed before attempting to use the values. Just because picking got an intersection doesn't mean the point locator query will succeed because they are using different techniques for testing intersection. Also picking generally uses a small region around the cursor. (so you could still get a picking hit when your cursor is a few pixels outside the surface) I found this code snippet from Piotrek on this thread that shows how to check the point locator setup/results for errors. http://www.si-community.com/community/viewtopic.php?f=16t=2595 I think that with proper error checking your issue will probably go away. -- Brent -Original Message- From: softimage-boun...@listproc.autodesk.com [mailto:softimage-boun...@listproc.autodesk.com] On Behalf Of Vincent Ullmann Sent: 14 June 2013 20:35 To: softimage@listproc.autodesk.com Subject: CustomTool Pick 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 Cursor As 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? attachment: winmail.dat
Re: CustomTool Pick
Hi, thanks for your response. Also picking generally uses a small region around the cursor This might be the Issue. So sometimes Pick will get a Object, but my GetRaycastIntersections will fail then becouse of that Radius. I assuemd Pick and Raycast will work similar enough so i could be sure to use Raycast-Information without have to recheck them. I saw Piotrek's Snippet bevore. I learend a lot from this (so thanks here) but i dint understood why he was checking everything twice. Now i know. ;-) Vincent Am 17.06.2013 12:42, schrieb Brent McPherson: Hi Vincent, The first place to start is by checking the return values to make sure the calls succeed before attempting to use the values. Just because picking got an intersection doesn't mean the point locator query will succeed because they are using different techniques for testing intersection. Also picking generally uses a small region around the cursor. (so you could still get a picking hit when your cursor is a few pixels outside the surface) I found this code snippet from Piotrek on this thread that shows how to check the point locator setup/results for errors. http://www.si-community.com/community/viewtopic.php?f=16t=2595 I think that with proper error checking your issue will probably go away. -- Brent -Original Message- From: softimage-boun...@listproc.autodesk.com [mailto:softimage-boun...@listproc.autodesk.com] On Behalf Of Vincent Ullmann Sent: 14 June 2013 20:35 To: softimage@listproc.autodesk.com Subject: CustomTool Pick 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 Cursor As 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?
CustomTool Pick
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 Cursor As 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() == Lpolymsh ) { // 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