When to use this
Use it when a model needs consistent framing across screen sizes, especially product viewers, configurators, avatars, thumbnails, and landing page hero scenes.
Perspective math
Calculate a PerspectiveCamera field of view that frames an object by height, distance, aspect ratio, and margin.
This snippet keeps the math explicit so you can adapt it to a bounding box from a loaded GLB model.
Use it when a model needs consistent framing across screen sizes, especially product viewers, configurators, avatars, thumbnails, and landing page hero scenes.
PerspectiveCamera.fov is vertical FOV in degrees. Horizontal FOV depends on aspect ratio, so it changes when the viewport changes.