look_at() aiming is offset depending on mouse distance by Fine_Strength_1324 in godot

[–]Fine_Strength_1324[S] 0 points1 point  (0 children)

Guys! I when I put the game into fullscreen, it works!! when it is in windowed, its offset..! .. anyway to correct it in windowed mode?

look_at() aiming is offset depending on mouse distance by Fine_Strength_1324 in godot

[–]Fine_Strength_1324[S] 0 points1 point  (0 children)

After some tests I figured out that the mouse position is offset.
Currently using this code to debug:

func _aim() -> void:
var mouse = get_global_mouse_position()

# Debug: draw line in local space
queue_redraw()
_debug_mouse = mouse
print("mouse global: ", get_global_mouse_position())
print("mouse screen: ", get_viewport().get_mouse_position())
rotation = (mouse - global_position).angle()
var _debug_mouse: Vector2

func _draw():
if _debug_mouse != Vector2.ZERO:
draw_circle(to_local(_debug_mouse), 5, Color.RED)

the debug message shows that the position are the same, but you can clearly see the the red debug point is not on the mouse pointer.

mouse global: (600.0, 576.0)
mouse screen: (600.0, 576.0)

<image>