Three.js zoom to fit width of objects (ignoring height) -
i have set of block objects, , i'd set perspective camera entire width visible (the height big - that's ok, we're going pan , down).
i've seen there number of questions close this, such as:
adjusting camera visible three.js shape
three.js: object size respect camera , object position on screen
threejs. how implement zoomall , make sure given box fills canvas area?
however, none of them seem quite cover i'm looking for:
i'm not interested in height, width (they won't same - size dynamic can presume height larger width)
the camera.position.z (or fov guess) unknown, i'm trying equations round right way solve that
(i'm not great 3d maths. in advance!)
i able simplify problem lot, in case...
since knew overall size of objects, able come suitable distance through changing camera's z position few times , seeing looked best.
my real problem same z position gave different widths, relative screen width, on different sized screens - due different aspect ratios.
so did divide distance value camera.aspect. blocks take same proportion of screen's width on screen sizes :-)
Comments
Post a Comment