vue-babylonjs
vue-babylonjs copied to clipboard
Bounding Box
Hello, I would like to load assets (.stl files) uploaded by users (so the origin of the file might not coincide with the centre of the mesh object): Is there a way to calculate the Bounding Box of a mesh (or more meshes ideally) and set its center as the target for the ArcRotate camera?
In BabylonJS I would use something like: mesh.getBoundinfo().boundingSphere.centerWorld
Thank you!
Hi, sorry this is late, could you prepare a minimally reproducible example on Glitch or something similar? Here's a starter example on Glitch.
Hi @BrainBacon, I was not able to get it working in Glitch but I have created a reproducible example and upload it here: https://github.com/gggggbbbbb/vue-babylon-test . In this example you can clearly see how the target ArcRotate camera does not correspond with the "center" of the displayed object (calculated from its bounding box) but rather with the global origin of the STL file loaded (which could be arbitrary).