I have to load a model in OBJ format and then to change the material of each mesh.
My code look like this:
var house = BABYLON.SceneLoader.ImportMesh("", "./model/", "Untitled.obj", scene, function(meshes){
scene.createDefaultCameraOrLight(true, true, true);
scene.createDefaultEnvironment();
// Meshes to be changed//
var Wall_1 = meshes[0];
var Flor_2 = meshes[1];
var Wall_2 = meshes[2];
var Roof_down = meshes[3];
var Roof_up = meshes[4];
var Flor_1 = meshes[5];
var Terase = meshes[6];
//------------------------------//
//Code that doesn't work correctly//
var newMaterial = new BABYLON.StandardMaterial("newMaterial", scene);
newMaterial.diffuseTexture = new BABYLON.Texture('model/2266_model/ROOF_Wood_1.jpg', scene);
Roof_up.material = newMaterial;
console.log(Roof_up.material);
console.log(Wall_1.material);
//-------------------------------//
});
It is working but the texture is not displayed as expected
This is the output
But it should look in this way
What can I do to make it work correctly?