How do I get the geometry of a loaded BranchGroup

Please Help!
Does anybody know a fast and simple method to traverse the scenegraph and retrieve the geometry for a pre loaded model in a branchgroup?

any examples would be good.

Thanks

In case there are several Shape3Ds in your branchgroup you’ll actually have several geometries… A call to shape3d.getGeometry() will reveal each one.

Call something like following method with your branchgroup in order to get a list of all your Shape3Ds inside it:


public List getShape3Ds(Node node)
{
  List shapelist = new ArrayList();
  addChildsToList(node, shapeliste);
  return shapelist;
}

private void addChildsToList(Node node, List addlist)
{
  if (node instanceof Shape3D) {
    addlist.add(node);
  }
  else if (node instanceof Group) {
    Group group = (Group) node;
    List childlist = group.getChildren();
    for (Iterator n = childlist.iterator(); n.hasNext(); ) {
      node = (Node) n.next();
      addChildsToList(node, addlist);
    }
  }
}

Thank you - just the job.