How to fit a model in a viewport frame perfectly

Hi so i was wondering how you would fit a model in a viewport perfectly, basically no matter the size of the model the camera would move for it to show a perfectly aligned model in the viewport frame.

I was wondering if any of you guys would know the math or know other pages which would help.

Thanks

Here’s a post that you might be interested in:

EDIT: Here’s a module specifically made for viewports by @EgoMoose

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.