Stretching Viewport

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By TitanicJoe


I use 3.2.3.stable
I have a scene:


In project settings I’ve set up window stretch mode: 2d and keep aspect. MainNode2d and Node2D have scripts, which printing global_mouse_position. After changing manually window size, (e.g. I receive small scene in the middle and dark borders), I click on left top corner of the scene and I expect to receive Vector(0,0) from both scripts. And MainNode2d did show Vector(0,0) but Node2D dit not. Node2D shows Vector(0,0) only on the left top corner of the window not the scene. How can I stretch AdditionalViewport or what calculation should I make to receive expected positions.

Isn’t the top left corner of the scene and of the screen the same point? Doesn’t MainNode2d occupy all of the screen?
Generally, viewports just fill the ViewportContainer they reside in. If you allow the container to stretch, then the viewport should follow.

avnih | 2021-04-23 08:20