| nunomartins01 2005-08-09, 7:40 pm |
| Hello
I'm starting to use protos and I can't create an instance of a
proto using SAI...
I have a x3d file (teste.x3d) whit a declaration of a proto:
<Scene>
<ProtoDeclare name='Wall'>
<ProtoBody>
<Shape>
<Box size='10 2 0.1'/>
<Appearance>
<Material diffuseColor='0 0.6 1'/>
</Appearance>
</Shape>
</ProtoBody>
</ProtoDeclare>
<NavigationInfo type='"EXAMINE" "ANY"'/>
</Scene>
In my java, I load the "teste.x3d" and try to crate an instance of
the proto:
mainScene = x3dBrowser.createX3DFromURL(new String[] { "teste.x3d" });
x3dBrowser.replaceWorld(mainScene);
X3DNode obj = mainScene.createProto("Proto");
SFString name_proto = (SFString) (obj.getField("name"));
name_proto.setValue("Wall");
mainScene.addRootNode(obj);
But his must be wrong...
Shall I use CreateInstance or createProto is enough?
Thanks
Nuno
|