| A new book features a demonstraion of the
| interactive "picking" of objects in a 3d Scene
| created from a VRML data file, and all the
| source code and data files are
|  ___ free ___ and are freely available.
|
| The VRML file is read and rendered, and
| with your mouse you can "pick" objects in
| the scene and it has an interactive
| representation of the Java3d Scenegraph
| that allows you to expand and collapse branches
| of the Scenegraph and examine the contents
| of the nodes of the scenegraph tree.
|
| It uses the popular, portable Sun VRML Loaders.
|
|
|| Picking of VRML objects with your mouse is
|| demonstrated in a new book, _ Java _ 3D _ Programming _,
|| by Daniel Selman ...
||
|| The source code is avaible for free. [ links below ]
|
  http://www.frontiernet.net/~imaging/games_with_java3d.html
  http://www.frontiernet.net/~imaging/sourcecode/VrmlPickingTest.java
  http://www.frontiernet.net/~imaging/sc_vrml_picking_with_java3d.jpg
  http://www.manning.com/selman/selman_source.zip
  |
  [ posted to java3d-interest list March 4, 2002 ]
  |
http://archives.java.sun.com/cgi-bin/wa?A2=ind0203&L=java3d-interest&P=6204


  [ in reply to comp.lang.java.3d post on March 19, 2002 ]:

geofuny wrote:
> here is my script:(the question is bottom)
>
>
>
> public class PickFleet extends PickMouseBehavior {
>
>     /** cuurent fleet object*/
>     private Fleet fleet;
>
>     /** Creates new PickShape
>      * @param canvas the current canvas
>                      where is drawing the scene graph of fleet object
>      * @param root the current scene graph of the fleet object
>      * @param bounds the current bounds of the fleet object
>      * @param fl the current fleet object
>      */
>     public PickFleet(Canvas3D canvas, BranchGroup root, Bounds bounds,
> Fleet fl) {
>         //constructs a new PickMouseBehavior
>         super(canvas, root, bounds);
>
>         //get the current fleet object
>         fleet = fl;
>
>         //limitation picking bound
>         this.setSchedulingBounds(bounds);
>
>         //PickFleet object added to the scene graph of the fleet
> object
>         root.addChild(this);
>
>         //bounds picking mode with a tolerance of picking
>         pickCanvas.setMode(PickTool.BOUNDS);
>         pickCanvas.setTolerance(0.1f);
>
>     }
>
>     /**proceed to get the VRML object picked
>      * @param xPos the x component of the picking mouse
>      * @param yPos the y component of the picking mouse
>      */
>     public void updateScene(int xPos, int yPos) {
>
>         PickResult pickResult = null;
>         BranchGroup bg=null;
>         //get the coordinates of the picking mouse into the canvas
>         pickCanvas.setShapeLocation(xPos, yPos);
>         //get the closest object picked
>         pickResult = pickCanvas.pickClosest();
>
>         if (pickResult != null) {
>             //get the branchgroup object picked
>             bg = (BranchGroup)pickResult.getNode(PickResult.BRANCH_GROUP);
>             ...
>         }
>     }
> }
>
> when i get the bg variable, his value is null when i pick the VRML
> object in the canvas.
>
> The objects are loading from VRML object and the result is an
> branchgroup node. That's the reason why i use a
> PickResult.BRANCH_GROUP.
>
> What's wrong with that?

  I'm not sure but I've usd the pick-ing code
from Selman's book and it worked properly,
the code is freely available ( see above ).

  Have you tried that yet ?

  Start with something that works, like this:


  VRML & Java3d for Games on the Web & beyond, & Picking.
  --------------------------------------------
  http://www.frontiernet.net/~imaging/games_with_java3d.html
  http://www.frontiernet.net/~imaging/sourcecode/VrmlPickingTest.java


  -- Paul, Java Developer & Web Animator
  --------------------------------------
"Imaging the Imagined: Modeling with Math & a Keyboard"

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