A weird offset angle when use look_at with get_global_mouse_position

Godot Version

v4.6.1

Question

Hi all, as the title mentioned, I got very weird and small offset angle when I tried to make my sprite look at the cursor.
My setup scene is very simple. The test node is the one I am checking. It has default transform, same for the parent (Gameplay-Scene)

Below is the simple code i use to look at cursor

extends Node2D


func _process(delta: float) -> void:
	look_at( get_global_mouse_position())

My sprite is pure sprite texture (I used atlas and choose a frame from it, same issue, so I did use this pure sprite texture to see if it is a problem)
The sprite is rectangle laid horizontally

I cant screenshot the cursor but here the example. Green X is the cursor position and the sprite is point at direction upper a little bit.

Bonus information:
My viewport is 320x160 and scaled into 1920x1080 with integer scale settings
My question is: what is the root cause make the sprite not look precisely at the cursor. How can I fix this

Show the position of sprite’s origin.

The sprite is at (318,112). Bonus: if I move the cursor to make the sprite point to the right, mouse from get_global_mouse_position is around (386,114). You can see there is slightly gap in Y

Those numbers mean nothing by themselves. Show where the pivot is relative to sprite’s texture.

Sorry didnt know this. Dont you mean this

What happens if you only assign mouse global position to sprite’s global_position each frame?

Okay after spending hours trying different settings, I found out that if you set your window mode to be Windowed and your resolution is at 1920x1080 (viewport at 640x320). There will be a miscalculated mouse position
I switched to Full screen and it was working fine
So in this situation there are 2 options to fix this:

  1. Set your windowed viewport to be 1920x960 (this value is integer scaled with 640x320 - your viewport). This is if you want to keep the window mode is Windowed
  2. Just set the window mode is Fullscreen and everything is good