Make the "GUI in 3D Demo" work for different GUI sizes

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

Hi, I have a question regarding the “GUI in 3D Demo”, which can be found here: GUI in 3D Demo - Godot Asset Library

When I want to change the size and ratio of the GUI, I can edit the size of the quad.
This breaks the example, because the code doesn’t refer to the quad size in any way and it seems to assume its (2,2).

I have no idea how I can change the code so that the example is still working for quad sizes like (2,4) etc.

:bust_in_silhouette: Reply From: Bartosz

You would need to adjust this code

# Convert pos to a range from (0 - 1)
pos.y *= -1
pos += Vector2(1, 1)
pos = pos / 2

I’m guessing that you would need to replace 2 with quad real size and 1 with quad half size