What does Camera2D.set_zoom() do exactly? Confusing results.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Payotz
:warning: Old Version Published before Godot 3 was released.

I’m having trouble understanding the behavior of Camera2D.set_zoom().

Basically I have two rooms that are different in sizes. The second room is larger than my resolution, so in order to render the whole thing, There is a “Player Node” inside the first room that have a Camera2D inside of it. The second room has a Camera2D in itself.

Room1 _ready():

get_node("Player/Camera2D").make_current()

Room2 _ready():

get_node("Camera2D").make_current()
get_node("Camera2D").set_zoom(Vector2(0.5,0.5))

My default scene is Room1.

So when I first loaded the game, everything is good:

enter image description here

And when I loaded Room2, it rendered everything perfectly:

enter image description here

Then when I came back to Room1:
enter image description here

As you can see, it’s really zoomed in without me doing anything. I’ve also tried get_node(“Player/Camera2D”).make_current() in _fixed_process(delta):

The only thing that I discovered is set_zoom(Vector2(-1,-1)) makes it inverted.
And set_zoom(Vector2(x,x)) [where x > 1] zooms it out even more

enter image description here

Question:

What does zoom do exactly? And how can I return Room1 into the “normal” zoom?
Also, why does setting zoom on one Camera affect the other?

:bust_in_silhouette: Reply From: YeOldeDM

That is strange. Your zoom shouldn’t be working at all, since the method takes one argument (a Vector2) and you’re giving it two floats.

set_zoom(Vector2(1,1)) will set the zoom to “normal”, 1 world pixel fills 1 screen pixel.

set_zoom(Vector2(0.5,0.5)) should zoom in (as in, one world pixel will fill 4 screen pixels).

set_zoom(Vector2(2,2)) should zoom out (as in 4 world pixels will fill 1 screen pixel)

My bad. I have Vector2 as an argument. I seem to have overlooked the thing in the question. I’ll edit it.

Payotz | 2017-04-06 00:26