Hi Doug!

Thanks for answering! I checked my pickTolerance and I saw that I was using
the default value(2.0). But even though I try set it higher my picking (of
lines) still not work.
I have included some of my code. Maybe I�m doing something wrong somewhere?
Thanks for helping me.

Todda


public void mouseReleased(MouseEvent e){

    if(e.isControlDown()==true) {

      int mouseX = e.getX();
      int mouseY = e.getY();

      //Get the eye position in view space
      Point3d eyePos = new Point3d();
      _canvas.getCenterEyeInImagePlate(eyePos);

      //Translate the mouse canvas position to view position
      Point3d mousePos = new Point3d();
      _canvas.getPixelLocationInImagePlate(mouseX, mouseY, mousePos);

      //Get the view-to-world transform
      Transform3D xform = new Transform3D();
      _canvas.getImagePlateToVworld(xform);

      //Transform eye and mouse from view to world space
      xform.transform(eyePos);
      xform.transform(mousePos);

      //Save the world pick ray origin
      _rayOrg.set(eyePos);

      //Build the world pick ray direction
      _rayDir.sub(mousePos, _rayOrg);
      _rayDir.normalize();

      //Set the the origin and direction on the PickRay object (_ray)
      _ray.set(_rayOrg, _rayDir);

      System.out.println("vector: " +_rayDir.x + ";" +_rayDir.y + ";"
+_rayDir.z);




      //PickTool picktool = new PickTool(_branchgroup);
      PickCanvas pickCanvas = new PickCanvas(_canvas, _branchgroup);
      pickCanvas.setMode(pickCanvas.GEOMETRY);
      pickCanvas.setShapeRay(_rayOrg, _rayDir);
      pickCanvas.setTolerance(4.0f);

      PickResult result = pickCanvas.pickAny();

      //_results = _branchgroup.pickAny(_ray);

      if(result == null){
        System.out.println("No hits");
      }
      else{

        Node shape = result.getObject();
        System.out.println("Real hit");
        System.out.println("Object: " +shape);

      }

    }

  }//end mouseReleased()



> > From: Tor Einar Kj�rkleiv <[EMAIL PROTECTED]>
>
> >
> > When using "picktool.setMode(picktool.GEOMETRY)" I am not able to pick
> > linearrays/linestriparrays. Is there an explanation to this? It works
>fine
> > when I�m picking other objects like cubes, cylinders, and so on.
> > Please help me. I think this a rather important question.
>
>Is your pick tolerance set to 0?  If so, then the pick shape becomes a ray
>instead of a cone and it becomes almost impossible to pick lines and
>points.
>
>Doug Gehringer
>Sun Microsystems
>
>==========================================================================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".


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp

===========================================================================
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".

Reply via email to