How to fit object inside canvas

I’m currently using (and I’m new here) this library to create 3d objects, but unfortunately I cannot fit the object inside the canvas. It’s always overflowing outside the canvas if the object is a bit long.

Stackoverflow link

Change the camera position, e.g.

camera.position.z = 1.2 * boxWidth;


camera.lookAt( , , );

1 Like

@hofk I tried, but I got the same result. Please see my update above.

Here are some functions to fit objects within a view using a few lines of trigonometry math: