Aligning Camera along local Z Axis to object matching viewport

Hi guys,

I'm new to this forum but I straight got a question.

I have different objects to be visualized in the same angle. The objects are of different sizes both width and height and need to fit the viewport/rendersize (2048x2048) on the bigger side. If it's wider it should fit the width of the rendering, and if the object is higher it should fit the height of the rendering.

Adjusting it manually is no solution since it's about 1.500 objects to be rendered so I am looking for a maxscript solution right here.

Would be great if one could push me in the right direction here. It would also be great to only adjust camera distance and NOT touch cameras FOV.

I thought about measuring the objects bounding box and calculate a factor. Then increase/decrease cameras distance by the calculated factor. it somehow works but I don't get good results since the camera distance seems to be not "linear", don't know how to better explaint this, sorry :(

Every hint is useful :>

Thanks in advance!
Dennis

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
pixamoon's picture

'

Just a quick idea:

1. switch view to camera
2. switch view to perspective (it will keep camera FOV)
3. select object
4. do zoom to selected
5. create camera from view (it should have same FOV as first camera)

Best,
Pixamoon

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.