Is it possible to do a "Zoom in/out" on Control Nodes?

Godot Version

4.4

Question

So I have created some Control Nodes in a scene, but then testing on smaller screen, I wish I could make them zoomable.

Is it possible to do something like the Magnifier app on Windows? (Use Magnifier to make things on the screen easier to see - Microsoft Support) I just want the player to be able to zoom in and out freely on the Control Nodes as they wish, but only zoom the relevant Control Nodes without affecting other nodes like Node3D.

Or how do we normally do this for Godot 4?

Help > UI

1 Like

You ought to be able to do this with a subviewport and a camera2d.

2 Likes

or a canvaslayer if you don’t want to use the viewport stuff

1 Like

@hexgrid @paintsimmon

Since you two suggested two possibilities, I would need to differentiate when to use them. Are below valid?

Goal Use
Keep things static on screen (UI, HUD) CanvasLayer
Create secondary camera views (minimap, alternate perspectives) SubViewport + Camera2D
Render a scene to a texture or control multiple independent viewports SubViewport + Camera2D
Add layers to manipulate draw order or parallax CanvasLayer

Also, I asked the AI, and this is its conclusion. Since I never used both, is it valid?

Do I want this to move with the main camera or stay fixed on the screen?

  • If fixed → CanvasLayer
  • If a separate scene or render target → SubViewport

I wouldn’t advise asking the AI anything. It will lie to you with perfect confidence.

Personally, I’m using a viewport+camera2d scheme for several parts of my game; it’s fairly easy to set up. In one case I’m using it because I want my UI kept separate from a 3D scene displaying at the same time. In another, I want to be able to move the UI easily.

Either solution should work fine for your case, I think.

2 Likes

a canvaslayer’s transform is independent of other canvaslayer’s transforms. so it can be used for pretty much everything you listed.

1 Like