@fire7side said:
Well, you could start out by printing the mouse position and the viewport size. See if those are correct. Click at upper left corner and bottom right corner and check the coordinates.
i hope i did this right

this is the modified script
func _input(event):
if event.is_action_pressed("click"):
var ABT1 = AB1.instance()
add_child(ABT1)
var XN = null
XN = get_viewport().get_mouse_position()
ABT1.position = XN
print("this is the viewport = ",Viewport)
print("this is the global mouse position = ",get_global_mouse_position())
print("this is the ABT1 position = ",ABT1.position)
this is what is shown on the debugger
this is the viewport = [GDScriptNativeClass:691]
this is the global mouse position = (-628, -268.991058)
this is the ABT1 position = (116, 79)
this is the viewport = [GDScriptNativeClass:691]
this is the global mouse position = (-329, -242.991058)
this is the ABT1 position = (415, 105)
this is the viewport = [GDScriptNativeClass:691]
this is the global mouse position = (-421, -88.991058)
this is the ABT1 position = (323, 259)
this is the viewport = [GDScriptNativeClass:691]
this is the global mouse position = (-214, -42.991058)
this is the ABT1 position = (530, 305)
this is the viewport = [GDScriptNativeClass:691]
this is the global mouse position = (-706, -295.991058)
this is the ABT1 position = (38, 52)
I clicked 5 times a put the spaces to make reading easier
edit
I added
print("this is the maybe mouse position = ",get_viewport().get_mouse_position())
then click at the top left corner and this is what I got
this is the viewport = [GDScriptNativeClass:690]
this is the global mouse position = (-734, -338.991058)
this is the maybe mouse position = (10, 9)
this is the ABT1 position = (10, 9)
then I changed the size of the window and clicked at almost the same positions
this is the viewport = [GDScriptNativeClass:690]
this is the global mouse position = (-989, -440.491058)
this is the maybe mouse position = (11, 8)
this is the ABT1 position = (11, 8)
edit 2
turns out that ABT1 is taking the same position as the mouse apparently
when you look at the debugger you see that they're in the same position
also if you take a look in abt1 in the remote inspector I also finds out that it's the same position what does that mean
