[Newbie] How to resize a ground based on the window's size?

I want to make a ground as big as the screen size. I tried to use window.innerWidth to calculate the ground’s width, but even I resize the screen, the ground does not resize:

const ground = MeshBuilder.CreateGround('ground', { width: window.innerWidth / 150, height: 5}, scene);

And this is how I attach the event listener:

    const handleResize = () => {
        (engine as Engine).resize();
    }

   window.addEventListener('resize', handleResize);

One workaround I can think of is to make the ground extremely large, so that it will exceed all possible screen size, but I want to add 4 walls later on to block the ground, and I want those walls visible in the screen, so making the ground extremely large might not be an option for me?

Hello,
I guess you’re mixing things a little here. You must have forgotten the ‘camera’ in your design thinking.
The ground size and the window/canvas size is one thing. But, in the end, the way you are looking at your scene is through your camera.
So, clearly you can already leave out all of the above you did on resize (sry). This can be useful to manage the resize of your window/canvas, but that’s about all it does.
If you want your ‘ground to always fit the full view’, you need to work it from the camera.
High level, you would look at your camera settings (position, rotation, radius…) before rendering (or before drawing) and adapt either your camera or your objects on camera change.
Now, this raises a question: What about the zoom of the camera? If you are looking more closely at your object target (say the ground center) then obviously, when zooming in very closely the walls will not be visible anymore, right? For this, you can set limits to your camera so that it will not allow to zoom-in with a factor that’s higher and would make your walls (or ground limits) to go off the size of the window.
Given the above, can you be a bit more precise towards what you expect with camera movement and camera zoom on target? May be you could start by telling us what type of camera you want to use?
Thx,

Edit: And I forgot to mention that your instruction for the width of your ground

the way we can see it here, is likely to be passed only once - when you build your ground. We do not have the full script here but, from what I suspect, I believe this value is not updated on resize and the ground is not re-drawned/rescaled. And then again, by any means, in the end, the camera (along with the window/canvas size) will set the limits.

Hello just checking in, was your question answered? @winston0410