thank you! maybe someone can help me with another problem....
i try to create a scenegraph with sai that looks like this:
<Transform>
<Shape>
<Sphere/>
</Shape>
<TouchSensor/>
</Transform>
i did this:
//create Shape
X3DNode shape = mainScene.createNode("Shape");
SFNode shape_geometry = (SFNode) (shape.getField("geometry"));
X3DNode sphere = mainScene.createNode("Sphere");
shape_geometry.setValue(sphere);
//create TouchSensor
X3DNode touch = mainScene.createNode("TouchSensor");
//create Transform
X3DNode transf = mainScene.createNode("Transform");
//add shape and touchSensor as children to Transform
MFNode ch = (MFNode)transf.getField("children"); //or
addChildren
ch.setValue(2, new X3DNode[] {shape, touch });
//add Transform to Scene
mainScene.addRootNode(transf);
but: where are the children? they are visible, but here nothing appears:
MFNode children = (MFNode)transf.getField("children");
for(int j=0; j<children.size();j++){
X3DNode n = children.get1Value(j);
System.out.println(n.getNodeName());
}
and: when walking the scenegraph with rootNodes as parameter (like in the
SAISGWalkDemo) it does not work:
X3DNode[] roots = mainScene.getRootNodes();
walkSG(roots);
i thought that getRootNodes() returned all Nodes of the Scene. is that
wrong? if yes, how can i achieve this? what would be the correct way to
make all nodes of the scene available (also the children of the transform)?