Camera Zoom To Fit Object

@fifonik I did originally use something like your cameraZ calculation and ran into issues so recalculated and arrived at my version.

I honestly don’t remember why now though - I wrote that function about 6 months ago and I’d rather not go over the maths again :laughing:

But try both versions and see which works for you.

BTW yes, it should be camera.position.z = center.z + cameraZ if the object is not positioned at z=0. Thanks.