Hello

On Saturday 06 March 2004 08:12, you wrote:
> I have any given scene to me in 3D...i want to use the mouse to click on
> some place on the scene and find out the cordinates of the clicked points.

(You will run into problems with capabilities)

1. create a mouse listener class by implementing
(java.awt.event.MouseListener),

2. register an instance of your mouse-listener as mouselistener to the
canvas3d-Object. (canvas.addMouseListener(....))

3. within mouseClicked(mouseEvent ev) method you have to use an Instance of
com.sun.j3d.utils.picking.PickCanvas:

setup:
     PickCanvas pickCanvas = new PickCanvas(canvas, scene);
     pickCanvas.setMode(PickTool.GEOMETRY_INTERSECT_INFO);
     pickCanvas.setTolerance(4.0f);  //or less ?

use:
     pickCanvas.setShapeLocation(ev);
     PickResult[] results = pickCanvas.pickAll(); //pickclosets, pickAny... ?

For each valid PickResult:

for (int j=0;j<PK[i].numIntersections();j++){
   PickinterSection PKS = PK.getIntersection(j);

   //use any of:
   PKS.getClosestVertexCoordinates();
   PKS.getClosestVertexCoordinatesWM();
   PKS.getPointCoordinates();
   PKS.getPointCoordinatesWM()
}

You will have to set a shitload of capabilities on ALL pickable nodes (in
scene, see setup) to get this up and working. Some i can think of right now
are:
GeometryArray:
ALLOW_COUNT_READ
ALLOW_COORDINATE_READ
ALLOW_FORMAT_READ

there may be more.

cu
Gilson Laurent

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