I have a mesh that is loaded from a j3o file converted from a blender model.
The standard model has a green material but I want some variations of it to be black or otherwise.
The below code works fine, but I find it wasteful to create a new material when there is one already. Can I just getChild() or getMaterial() to find the material, and set its color to black, instead of replacing it with a new one?
I found setMaterial methods as below, but no getMaterial or such.
[java]
private void redress() {
Spatial apa = (Spatial) this.getChild(“Cylinder.0031”);
Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
mat.setBoolean("UseMaterialColors",true);
mat.setColor("Diffuse", ColorRGBA.Black);
apa.setMaterial(mat);
ParticleEmitter spark = (ParticleEmitter)this.getChild("spark");
spark.setStartColor(ColorRGBA.Red);
}[/java]