0 votes

I'd like to keep my Labels displaying text always at the same size, regardless of zoom level.

I have a camera that zooms in/out with the mouse wheel. And I also have numbers popping all over the map to indicate damage taken and such. However, once you start zooming the text becomes blurry, and at extreme zoom levels, unreadable.
I mention this because if the only solution is using a CanvasLayer, I still need to keep the Labels positioned in the map (world space).

I've already tried all the Mode and Stretch proyect settings combos, to no avail.

Any ideas? Thanks!

Godot version 3.4
in Engine by (191 points)

1 Answer

+1 vote
Best answer

There might be better ways, maybe using some control nodes , but a quick fix would be to decrease the scale of the labels by the same amount of your camera zoom. Not sure if the amounts have the same meaning but yhea they probably have (since they both start at 1 and if you go 0.5 its half the original value).

Try this and let me know! label.scale.x = 1/camera.zoom.x (same with y)

by (356 points)
selected by

This is so simple but it would totally work. Thanks!

For the record, you can change both axis in a single line of code:

label.scale = Vector.ONE / camera.zoom

oh haha, great tip! glad it helped!

1.) But what is the Vector.ONE? and how do I get that?

2) My problem is that my font is ugly without zooming

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.