[SOLVED] How to resize window correctly when using OrthographicCamera

Hi,
I’m using OrthographicCamera and I try to update the camera when browser window is resized. But after changing camra parameters, the cube scales incorrectly.

Before

After

Demo is here and any help would be great appreciated :slight_smile:
https://jsfiddle.net/fiddleslow/n0h13jxv

It works fine, you just forgot to change

    camera.left = size * aspect / -2;
    camera.right = size * aspect / 2;

to

    camera.left = size * newAspect / -2;
    camera.right = size * newAspect / 2;

2 Likes

Thank you for pointing out my mistake. Now it works as expected:)

1 Like

Np! Welcome! Please hit the “Solution” button to mark it solved, and/or put [SOLVED] in the title to help others.