+1 vote

So many questions :).

I have a camera which is able to zoom in and out and i have a label which shows the amount of zoom. How can I prevent that the label is also getting zoomed.
I tried to use more nodes and nest everything in different ways but had no success so far.
Do i have to use a second camera with another viewport?

asked Mar 23, 2016 in Engine by grol (94 points)

2 Answers

+5 votes
Best answer

Put your label as child in a CanvasLayer

answered Mar 23, 2016 by jospic (1,378 points)
selected Mar 24, 2016 by grol

This blocks the position but not the zoom. Or did I miss something?

No sorry. It also blocks the zoom. I only have to figure out what position it has relative to my viewport.

0 votes

Assuming you are in 2D (I never tried 3D before)
I would add a function to the camera to return the zoom amount:

func get_zoom_amount():
  return get_zoom();

then I'd make a new parallaxBackground, check ignore zoom add the label as child.

On the label, add a script to set the text using the get_node("camera").get_zoom_amount() change it basing on the hierarchy.

answered Mar 23, 2016 by Alex\doc (105 points)
edited Mar 23, 2016 by Bojidar Marinov

That worked. Thanks.

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 How to use this Q&A? before posting your first questions.