Hello,
i've created a box using SketchUp, exported it as a 3ds model and loaded it into jme. Now i'm triying to change the color of one of it's groups.
I didn't use obj files because of the lack of 'group' support. When i request the node's children from an obj file i just receive groups with names like tempX and not the originally assigned ones. The only advantage was that i managed to color the box lid.
Load a 3ds model file:
URL model=HelloModelLoading.class.getClassLoader().getResource("Box.3ds");
FormatConverter converter = new MaxToJme();
ByteArrayOutputStream BO=new ByteArrayOutputStream();
converter.convert(model.openStream(), BO);
Node box=(Node)BinaryImporter.getInstance().load(new ByteArrayInputStream(BO.toByteArray()));
box.setLocalScale(.07f);
box.setModelBound(new BoundingSphere());
box.updateModelBound();
Retrieve lid-child:
Spatial lid = box.getChild("lid");
Until this point everything works fine. When i try to remove the lid by 's.removeFromParent()' it works perfectly.
Setting MaterialState:
MaterialState ms = display.getRenderer().createMaterialState();
ms.setEmissive(new ColorRGBA(0f, .2f, 0f, 1));
lid.setRenderState(ms);
But at this point nothing happens. When i used the obj file in a similiar way, my lid would now be green.
I found this similiar thread but it didn't help me very much:
http://www.jmonkeyengine.com/forum/index.php?topic=11299.0
Any ideas? I just started working with 3d models and the jme ...so be gentle ;)
I've also tryed to call lid.updateRenderState() or box.updateRenderState() at various points but it didn't do the trick.