Scale in horizontal and vertical direction on window resize

In case you decrease the size of your window vertically the whole scene scales down. But if you decrease the size horizontally, there is no scaling and the scene just gets cropped.
I spent many hours creating this playground to showcase this: Babylon.js Playground.
On horizontal window resize the mesh always stays completely visible due to rescaling. On horizontal scaling the mesh does not scale.

My feature request would be to have it scaling in both directions.

I have found another topic on this: Scale on resize - Questions & Answers - HTML5 Game Devs Forum. But it looks like there was no final solution?

I do not see the behavior you are describing on the playground.

Hmm, thats strange. Here are some screenshots. Maybe I just didnt explain myself very well.

Vertical Scaling: The Mesh gets scaled down:

No Horizontal Scaling: The Mesh keeps the same size and just the viewport gets smaller which cuts of part of the object:

Hey,
try this:
https://www.babylonjs-playground.com/#TT2BK1#15

1 Like

I see the same behaviour as previously on that playground.

I managed to do it for my specific usecase adjusting the viewport in a way that it always fits a specific mesh either horizontally or vertically into the viewport.

1 Like