Qusetions about texture mapping and getModel



I read the material in beginner and notice that i must use spatial.setMaterial to apply a material.

But now there are so much models in my scene, this means that i must setMaterial to every spatial manually.

Is there a convenient way to do this?


In 3dMax i named the models, is possible that catch them in JME3 by their names?

Appreciate for your reply!

1- You can create a recursive method for setting the materials for your models in a scenegraph.




public Spatial getChild(java.lang.String name)
getChild returns the first child found with exactly the given name (case sensitive.)
name - the name of the child to retrieve. If null, we'll return null.
the child if found, or null.

1-hmm… maybe my expression is not clear.I mean that there’s so much models and every model has a difference texture,what should i do to

mapping the texture to the right model automatic.

e.g. I load the texture<.png> into something like a TextureManager first, and when i create the model, it will get a texture from the textManager to mapping itself automatic.

2-yes…that’s it.I misunderstood this,thanks.

1 - You write the code that does that :roll:

@normen said:
1 - You write the code that does that :roll:

yes....i just suddenly realize it
Maybe i need a rest....

Thank you all :)

ad1: http://hub.jmonkeyengine.org/groups/general-2/forum/topic/using-lod

last post of first page, just modify it.