Hi!
I’v finaly managed to get everything up running with the new jme3. Many tweeks and things to do but now its working.
So as I started the game, the house texture is not correct.
Its like the whole UV settings made in blender are removed.
I know I asked how to fix this before, but that was with the old jme3. With the new version I stand clueless.
I got the house.mesh.xml and the house_1.png texture and the house.material in same folder.
Also got a copy of the texture in another folder in the image folder.
Heres my code for creating the house:
RigidBodyControl house = MeshManager.StaticMeshNode("House_1", "House_1.png",20);
That one calls this one:
[java]public static RigidBodyControl StaticMeshNode(String name, String texture, float scale){
Node shape = ShapeManager.ShapeMesh(name,texture);
shape.setLocalScale(scale);
CollisionShape sceneShape = CollisionShapeFactory.createMeshShape(shape);
RigidBodyControl house = new RigidBodyControl(sceneShape,0);
MainClass.getRoot().attachChild(shape);
shape.addControl(house);
MainClass.getPhysics().add(house);
return house;
}[/java]
And this one calls the one under:
[java]public static Node ShapeMesh(String name, String texture){
Spatial model = MainClass.getAsset().loadModel(name+"\"+name+".mesh.xml");
model.setMaterial(MaterialManager.Texture(texture));
System.out.println(model);
return (Node) model;
}[/java]
Which finaly uses the texture method (which I think is the source problem):
[java]public static Material Texture(String name){
Material mat = new Material(MainClass.getAsset(),"Common/MatDefs/Misc/Unshaded.j3md");
mat.setTransparent(true);
mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
Texture img = ImageLoader.Load(name);
img.setWrap(WrapMode.Repeat);
mat.setTexture("ColorMap", img);
return mat;
}[/java]
That use this one (last one I promis):
[java]public static Texture Load(String name){
File imageFile = new File(source+name);
MainClass.getAsset().registerLocator(imageFile.getParent(), FileLocator.class.getName());
return MainClass.getAsset().loadTexture(name);
}[/java]
I used to have SimpleTextured.j3md but its apparenly "Obsolent" so I had to use Unshaded (tho I must have shadows).
So where do I do wrong?