Get the Java3D documentation, and read about Picking. There are examples in the standard Java3D demos. Essentially, you have to cast a ray from the notional 'eye', through the mouse pointer and into your Universe. Test for intersections with your Shape3Ds, and detect them. Choose the one you want (normally the one, nearest the 'eye'), and there's your clicked object.
There are utility classes to do the difficult stuff (casting the ray, testing for intersections), but its not quite as easy as Swing or some other 2D environment. Lewis. -----Original Message----- From: Discussion list for Java 3D API [mailto:[EMAIL PROTECTED] On Behalf Of Robert Gomez-Reino Sent: 09 September 2003 08:25 To: [EMAIL PROTECTED] Subject: [JAVA3D] Clickable objects Are the Shape3D's clickables somehow? Can anybody tell something about this? Thanks, Boby ----- Original Message ----- From: "Glenn Pinkerton" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, September 08, 2003 10:45 PM Subject: [JAVA3D] major memory leak > Hello, > > I saw some discussion of a major memory leak in java3d, and I think I > am running into the same problem. > > I am currently just creating a swing JFrame with a panel inside it. > The panel parents the canvas3d. Here is the constructor for the > panel. > > J3DPanel () > { > setLayout (new BorderLayout()); > GraphicsConfiguration config = > SimpleUniverse.getPreferredConfiguration (); > canvas = new Canvas3D(config); > add (BorderLayout.CENTER, canvas); > canvas.setBackground (new Color (240, 240, 240)); > universe = new SimpleUniverse (canvas); > } > > > When the JFrame that parents the panel is disposed of by the user, the > following cleanup code is called. I tried to pattern this after some > of the ideas in > the > interest group discussion. > > private void cleanup () > { > System.out.println ("3d cleanup called"); > System.out.flush (); > if (universe != null) { > universe.removeAllLocales (); > universe = null; > canvas = null; > } > System.gc(); > System.gc(); > } > > I know the cleanup is called because the println is executed. > > When I repeatedly create a scene and dispose of the frame, I lose > several megabytes of memory for each repetition. This is a major > problem that makes using Java3d for a > real world application > untenable. I recall from my reading that Sun had this as a bug. Is > there a > fix for the bug yet? > Is there any other workaround for this? Is there some way to use the > VirtualUniverse class rather than the SimpleUniverse class to get > around the > problem? > > > Thanks, > > Glenn > > ======================================================================== === > 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". =========================================================================== 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".