I have found the way.
I now managed to make a script that does exactly what I want it to: Align the view to the middle or bottom (or it can be aligned to anywhere from top to bottom).
The script expands the camera's Up limit when the Window size exceeds the camera's Bottom limit, so it only works when the camera's Default up limit is 0, for exactly this reason.
The script needs to be attached to the camera you want to realign.
Or it can be attached to something else if you change the extends
and set the camera
variable accordingly.
extends Camera2D
func _process(_delta):
align_view()
onready var camera = get_node(".")
export (float) var cam_extension_direction_y = -0.5
# -1 = Top
# >-1 and <-0.5 = Range between Top and Middle
# -0.5 = Middle
# >-0.5 and <0 = Range between Middle and Bottom
# 0 (Or better remove the script) = Bottom
func align_view(): if get_viewport_rect().size.y > camera.limit_bottom:
camera.limit_top = ( get_viewport_rect().size.y- camera.limit_bottom ) * cam_extension_direction_y