Try this, the easiest way:
var click_pos := Vector2.ZERO
func _physics_process(delta):
if Input.is_action_just_pressed("mouse_left"):
click_pos = get_local_mouse_position()
#Use here the click_pos.x as the x position of mouse
But first, define the mouse_left
input map in the project settings.
1 Like
Ah that makes perfect sense, I was using global position, thank you.
1 Like
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.