fit camera viewport to object size

On 22/03/2013 at 09:01, xxxxxxxx wrote:

Example, i have a plane in x/y and an orthogonal camera with an offset in z. Is it possible via script or plugin to zoom the camera, that the viewport shows exactly the polygon object plane? i know this depends on the render aspect ratio, but this is given by the plane. thanks

On 22/03/2013 at 10:23, xxxxxxxx wrote:

Hi Helge!
I seems that an ortho camera placed at 0 ,0, 0 with a zoom factor of 1, will cover a plane (facing the camera) placed at 0, 0, 0 that measures 1024 cm in width regardless of your render resolution. So if your object is 2048 cm wide, you'll have to set the camera zoom factor to 0.5. If your plane is 512 cm wide you'll have to set your cam zoom factor to 2.


On 25/03/2013 at 01:39, xxxxxxxx wrote:

Jepp that is right, now i will do some math to calculate the camera zoom. thanks

On 25/03/2013 at 02:16, xxxxxxxx wrote:

Hi Helge,

there was a thread here on the cafe about exactly this topic. I didn't test it, but the script should
work for any camera perspective.