If you are using a loader to load the VRML then mixing Java3D and VRML generated nodes is certainly possible. There are many options about how you combine the objects together as the VRML nodes consist of standard javax.media.j3d.SceneGraphObjects
allowing them to be placed anywhere within the scenegraph.
Doug Gehringer (Doug.Gehringer@west.sun.com) from the VRML browser team recommends the following approach:
The simplest way to do this is to have the VRML content and the new nodes be
separate scene graphs. The VRML scene would be one BranchGraph attached to the
locale and the new nodes would be other BranchGroups that get added to the
locale. This works fine unless you want to make the new nodes be attached to
the VRML scene graph.
For example, if you have VRML scene with a chair in and you want the new node to
be a model of a person sitting in the chair. You can make this case work by
making the VRML file have an "attachment point" for the new node. The chair
could have a Transform node in the right location with DEF name:
Group { # this holds the chair and the person
children [
Shape {...} # this is the chair
DEF Chair_seat Transform {
# the new nodes will be children of this node
}
}
}
The VRML loader will make a TransformGroup for the "Chair_seat" Transform node
and will store it in the DEF table. After loading the scene, you can get the
mount point using the named object table:
VrmlScene scene = vrmlLoader.load(url);
Hashtable defTable = scene.getNamedObjects();
TransformGroup seat = (TransformGroup) defTable.get("Chair_seat");
Set the capability bits on the chair's TransformGroup to allow children to be
added after the scene is made live. Then attach the VRML scene to the locale.
When the user hits the button, add the a BranchGroup containing the new nodes to
the TransformGroup (remember that only BranchGroups can be added to a live scene
graph).