Hello,
sorry if this is a silly question but I am quite new to BabylonJS and a bit swamped with questions.
I would like to create a simple App that is able to load models ( obj and glts ).
Now all works fine except that some models are much larger than others.
I would like to tell the camera to zoom the model to its bounding box or scale the model to a fixed size.
I have used camera.setTarget sucessfully to focus on the target, but how can I get a zoom to the bounding box?
Thanks a lot.
hi you can get mesh size mesh.getBoundingInfo() and use camera.radius property for set distance from camera to target but if you target fixed on mesh your camera move to new radius distance. and you can use camera behaviors for smooth animation camera movements. but if you use free camera you need set camera position because this type of camera don’t have target and radius property
createDefaultEnvironment does this for you https://www.babylonjs-playground.com/#8IMNBM#1
Other PG examples Available Meshes to Import - Babylon.js Documentation
thanks a lot!