Get_global_mouse_position() is not functioning correctly (already solved)

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By random_developer

I don’t know why but… it looks like get-global-mouse-position() is giving the wrong coordinates… exactly 60 degrees wrong…

my code here:

func _process(delta):
    a = get_global_mouse_position()
    look_at(a)
    print(a.x)

i am using the code in an area2d , and there is no modification of the position of the area…

any idea how to resolve this?

EDIT: the problem is already solved

Did you rotate the area2D in the editor?

dethland | 2022-12-12 06:06

What is the value of a.x when the mouse is at the far left and far right of the screen?

SteveSmith | 2022-12-12 10:24

sorry for the delay, but I identified the problem, the mouse position was correct, the problem is that there were 2 objects together, the first was invisible and the second was in the wrong position, implying that what was wrong was the first object and its script

a very silly mistake on my part lol, I’m still learning how some engine specific functions work…

once again… sorry for the delay in my reply and thanks for the consideration of helping me with the question

random_developer | 2022-12-14 12:36