GLR
GLR

Reputation: 1120

three.js Orthographic Camera: Zoom All

I am a complete newbee to three.js, and I cannot find out how to implement a "zoom all" with a OrthograpicCamera. I have been searching on the documentation and on the web, and I have only found solutions for PerspectiveCamera, that involve altering the field of view.

My goal is to achieve a fitting of all the 3D objects of a scene to the screen, so they are shown as bigger as possible. Any ideas to achieve this will be helpful. Thanks.

Upvotes: 0

Views: 1853

Answers (1)

Holger Ludvigsen
Holger Ludvigsen

Reputation: 2546

You could calculate the 2D screen space bounding box around all the objects, and then use that to set the height and width of the orthographic camera. See how to calculate it here: ThreeJS 2D bounding box of 3D object

Upvotes: 2

Related Questions