How to get the largest mesh size in the scene

I want to switch the camera view according to the largest grid in the scene

Could you provide a repro in Playground so we would be able to help you better?

So, with the ‘largest grid’ you mean the ‘largest mesh’, am I right?
Also, as far as I understand you don’t need to take the ground into account?

You can do something like this:

    const largest = scene.getMeshesById('').sort((a,b) => 
       b.getBoundingInfo().boundingBox.extendSizeWorld.length() -
       a.getBoundingInfo().boundingBox.extendSizeWorld.length()
    )[0];
    camera.setTarget(largest.position)

extendSizeWorld.length is volume of bounding box. Not sure what you mean by largest.

Hope that helps!

-flex

1 Like

yes,

thanks a lot i’ll try it