Querying scenegraph created using Quake3Loader

I’ve been playing with David Yazel’s Quake loader he kindly made available a couple of weeks back, and was wondering if it was possible to query the scenegraph the loader converts the Quake 3 map into.

At the moment I’ve been trying things like this to return the children from the scenegraph which holds the Quake map:


BranchGroup scene = createSceneGraph();
        
            Enumeration e = scene.getAllChildren();
            while(e.hasMoreElements())
            {
                  System.out.println("printing sg elements: "+e.nextElement());
            }
            locale.addBranchGraph(scene);

        runRenderer();

This seems to return less children than I expected.

Is it possible to do this, so I could potentially pick out objects from the Quake bsp map using xith?

Thanx

E.

You have to notice that some of these children have children themselves (and so on).

Try a recursive method to display all children. In the picking tutorial made available at xith.org there is a piece of code that might shed some light into your problem:


      public static void setPickableRecursive(Group group)
      {
            group.setPickable(true);

            Enumeration e = group.getAllChildren();
            while (e.hasMoreElements())
            {
                  Node node = (Node) e.nextElement();

                  // if it's a group rename all children
                  if(node instanceof Group)
                        setPickableRecursive((Group)node);
                  else
                        node.setPickable(true);
            }
      }      


As you can guess, this method turns all childreen of a certain group pickable. Just add a System.out.println() somewhere to get the info you desired.

or simply use

scene.printBounds(true);

this prints out all bounds and names (if given) of each node in the scene :wink:

that should do it too 8)
and its output even has some indentation :stuck_out_tongue:

Thanks, but I think what I’m looking at eventually can’t be done. The Quake BSP format and the loader/converter does not have any ability to produce any sort of identifier I can use to get hold of a particular Java/xith/scenegraph reference.

I want to recognise individual collisions in a scene to bring up awt dialogues when they happen e.g. walking into a tree. Unfortunately this is impossible as an individual tree in a scene can not be distingushed as far as I can see.

The suggestions given allow me to get the children in the scenegraph :slight_smile: but ultimately the information doesn’t contain what I need to accomplish my task. :frowning:

Back to ASE I guess.