What would be a function to output a number for the camera position’s z
value based on a number of factors:
-
fov
: (default 50) -
windowWidth
: (window.innerWidth) -
3DObject size + position
: (PlaneGeometry with width 5, height 5 and position [0,0,0]) - camera X,Y is 0,0
- what is the Z value so that the object’s width fits exactly the browser width (don’t care about the height fitting)
so something like:
function getZ(fov, objectWidth, browserWidth) {
}