How is the x and y pos of a label affected by camera zoom?

To my current knowledge, the x and y of a label is its distance from the origin of the camera. In my current project I also am messing with the zoom function of the camera. I want a label to “follow” a player, but I cannot get the function right. at 100% zoom it works fine, but once you change that and the player moves around the label moves at a different speed from the player. For example, if you had 80% zoom (which makes everything smaller) the player moves at 80% speed in terms of the screen. However, the label still moves at 100% speed

Nope, x and y is origin to the top left corner of the game.
Zoom doesn’t update correctly for UI positions including clicks.

I’ve made a math formula that should work with your zoom position.
Flowlab Game Creator - Mouse to Zoom

1 Like

Ok so I need a “game level” pos to go to a gui pos.
Looking at your equation you have
(GUI.X * 100/Zoom)-(Screen.X/2 * 100/Zoom)-(Screen.X/2) = Game.X
Using algebra:
GUI.X = (Game.X + (Screen.X/2*100/Zoom)+(Screen.X/2))*Zoom/100 + Camera.X
Does this seem right?
I can’t get it to work :frowning:

What I have in my notes is:

(Mouse/GUI X/Y) * Zoom Multiplier - (Screen Length/Width) * Zoom Multiplier /2 - (Screen Length/Width) /2
Zoom Multiplier = 100/Zoom



So yes, the math seems right for the most part.
But you’re not looking for GUI X because that’s what It’s already looking for.

Basically this is an offset adjustment, so it will be GUI + (GUI+Math)

1 Like