Hello everybody !
I've got a question about boundingspheres.
I want to set my camera to an appropriate distance from my meshes to see all of them in my frucstrum.
I tried the code below, it's working if boudingspheres of my meshes are not too far or if there is just one mesh.
I want it to work for every meshes importation, so I have to merge my boundingspheres but I don't know how to do it.
for (let i = 0; i < newScene.meshes.length; i++) {
test = newScene.meshes.getBoundingInfo().boundingSphere;
camsum += test.radius / Math.sin(this.camera.fov / 2);
}
let camaverage = camsum / newScene.meshes.length;
this.camera.radius = camaverage;
Some advices ?
Thanks for your time !
DeathSoul