How camera fit object to left half side of the screen(width and height)

Hi,

After clicking the button, I want the whole 3D object(width and height) to fit to left side of the screen and show a div HTML info in the right side of the screen.

How to fit object to left side of the screen without changing camera.fov? Is it possible to set margin(px) like the following picture?

Here is the fiddle.

Thanks!

/cc

Perhaps a layout would help others. I can see a few ways but not sure exactly. like for example A or B.
image

Hi @blackstrings0, example A is what I want. Thanks.

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

You could tweak those functions to operate on half of the view instead of the full view.

Just in case anyone looking for this I found a solution too for “A”

this.camera.setViewOffset(window.innerWidth * 1, window.innerHeight, window.innerWidth * 0.25, 0, window.innerWidth, window.innerHeight)

That’s all after the PerspectiveCamera (maybe play with the numbers + - )

2 Likes