Durga.Banda wrote: >Hi, > >I'm setting the shape in the PickCanvas utility as a cylinder ray. The >origin point and the direction is taken from the default PickCanvas >shape(ie >PickConeRay). But it is not picking the point in the correct direction. I'm >attaching the code, please see if the direction has to be set to something >else. >I'm using OrbitBehaviour in the application which is attached to >ViewingPlatform. > The following PickCanvas code works OK for me:
PickCanvas pickCanvas = new PickCanvas(canvas, root); pickCanvas.setMode(PickTool.GEOMETRY_INTERSECT_INFO); pickCanvas.setTolerance(1.0f); ... pickCanvas.setShapeLocation(x, y); PickResult results = pickCanvas.pickClosest(); if ( results != null ) { PickIntersection info = results.getIntersection(0); intersectionPoint = new Point3f(info.getPointCoordinates()); } Hope you can get some help from this. Best Regards, Roger Berggren > >Thanks in advance, > >ravi > ><<CODE>>------- > > PickCanvas pickCanvas = new PickCanvas(canvas3D, m_locale); > pickCanvas.setMode(PickTool.GEOMETRY_INTERSECT_INFO); > pickCanvas.setTolerance(1.0f); > pickCanvas.setShapeLocation(me); > > Point3d p3d = new Point3d(); > Vector3d v3d = new Vector3d(); > > canvas3D.getPixelLocationInImagePlate(mouseEvent.getX(), >mouseEvent.getY(), p3d); > ((PickConeRay)pickCanvas.getPickShape()).getDirection(v3d); > > Transform3D temp = new Transform3D(); > canvas3D.getImagePlateToVworld(temp); > temp.transform(p3d); > > pickCanvas.setShapeCylinderRay(p3d, v3d, 0.02); > PickResult pickResult = pickCanvas.pickClosest(); > > if (pickResult != null) > { > PickIntersection pickIntersection = >pickResult.getClosestIntersection(p3d); > > if (pickIntersection != null) > { > Point3d p3d1 = new Point3d(); > p3d1 = >pickIntersection.getClosestVertexCoordinates(); > > System.out.println("p3d1 : " + p3d1); > } > } > >=========================================================================== >To unsubscribe, send email to [EMAIL PROTECTED] and include in the body >of the message "signoff JAVA3D-INTEREST". For general help, send email to >[EMAIL PROTECTED] and include in the body of the message "help". > > > =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA3D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".