three.js Orthographic Camera: Zoom All

谁说我不能喝 提交于 2019-12-25 09:08:39

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/45995313/three-js-orthographic-camera-zoom-all

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!