Efficient Picking?

I have my terrain and player objects working nicely, and am now playing around with object selection (picking?).  The following is a snippet of code I gleaned from the examples, and it does seem to work, however I am finding that it will lag significantly on click.  I'm assuming this approach would be better if I could limit the ray to a certain collision box surrounding the world?  Not sure how that or something equally efficient would be accomplished?



I'm only concerned with finding the actual object clicked on, not any particular tri or part of it (I guess that's referred to as the mesh?).



       MouseInput.get( ).addListener( new MouseInputListener( )
        {
         public void onButton(int button, boolean pressed, int x, int y)
         {
            TrianglePickResults pick = new TrianglePickResults( );
            Ray ray = new Ray( camera.getLocation( ), camera.getDirection( ) );
            scene.calculatePick( ray, pick, 0 );
            if( pick.getNumber( ) > 0 )
            {
               System.out.println( "Picked: " + pick.getPickData( 0 ).getTargetMesh( ).getName( ) );
            }
         }

         public void onMove(int xDelta, int yDelta, int newX, int newY)
         {
         }

         public void onWheel(int wheelDelta, int x, int y)
         {
         }
       } );

If you are only interested in the Object itselfs  use BoundingPickResults instead of TrianlgePickResults. Just replacing the one line should be enough.


TrianglePickResults pick = new TrianglePickResults( );


-->

BoundingPickResults pick = new BoundingPickResults ( );