Fitting Camera view to the largest mesh in the imported model

Good Day,
I have a model with several parts inside it. When importing the glb model into babylon, I want to set the camera view to show the complete model irrelevant of the model scale (Similar to the Babylon sandbox). I saw a similar forum but the answer was given to a single mesh file. But my models will be of different sizes.

Hi.

You can check suggestions here. My answer there (scroll down few answers) specifically talks about your issue, with the working example in the playground.

Thanks for the help, I’ll have a look at the code, try it and let you know.

You can also try scene.createDefaultCamera(true, true, true).

Thanks but that didn’t work for me. @nogalo’s solution worked flawlessly. I’ll mark it as the solution. Thanks guys.

1 Like