Scaling not working with Imported Mesh

I am using ImportMesh function to import a 3D model but unfortunately the model is not getting scaled. I tried the following and yet there is no effect. What am I doing wrong?

BABYLON.SceneLoader.ImportMesh("", "scenes/", "Room.obj", scene, function (mesh) {  
        mesh[0].scaling = new BABYLON.Vector3(0.05, 0.05, 0.05); //Not working

        mesh[0].scaling.x = 0.05; //Also not working

Well, it’s hard to say. That seems like it should working. But my guess is that mesh[0] is not right pointer, but without seeing that in playground, I cannot say. Double check what mesh[0] is.

Can I add my model to a playground? Could not find the link to upload a 3D model to playground.

Thanks I have created a playground and here is the link:

You can (and should) always log the object you are not sure about. For example, you can see that logging the “meshes” array shows that there is more than 1 mesh in the scene (92 to be exact). So your code IS working, but for one of the 92 to meshes, so you scaled something in the scene :smiley:

What you can do is to loop through all the meshes of the “meshes” array and apply scaling for each mesh.

1 Like

Perfect. It did not even hit me. Thank you

1 Like