Obj materials Group and more

Hello to all,



first I want to apologize my bad English , I will try my best.

I  have some problems, hoping to find someone here who can give me a little help. I want to use JME for present some 3d visualisation. For this I import obj files. After some hours…:slight_smile: this works fine. But now, I want to have access to the groups of the original obj file, to use a different color or texture for every group.

Till now I don

Ok, I can add some additional informations now.

The converter seems to look after different materials within an OBJ-File and not after the groups I made.

For every different material it creates a Child.

So if I want to use different materials I have to add them in the mtl part of the obj File.



To go through the childs of the Node I found this code:


for(Spatial s : n.getChildren()) {
             ...             
          }



So I get the child as an Spatial. But how can I now get access to the following things:
(I know, that seems to be basics, but I found no solution till now)

- get the actual material
- give a new  color /material to the child
- --> together change the material

I

You want to get the MaterialState of the Child and change it.


MaterialState ms = (MaterialState)Spatial.getRenderState(StateType.Material);



Not every Child needs to have its own Materialstate tho, the State could also only exist on the top Node, all children of a Node inherit Renderstates.

I think nymons SceneMonitorcould help you inspect the jme representation of your model.

Hi Core-Dump,



thank you a lot. That brings me me a big step forward.

Like I

I didnt use Picking often yet.

But you can cast a Ray from your cursors location and see which meshes are hit.



Look for Picking examples in the jmetest package, jmetest/intersection/TestTrianglePick or similar.