can i get absolute position when i click screen in 2d?

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

var path = load("res://0_practice_folder/add_mesh_2d/Sprite.tscn")
var ins

func _input(event):
	if Input.is_mouse_button_pressed(BUTTON_LEFT):
		ins = path.instance(event.position)
		ins.set_position()
		self.add_child(ins)
		print(event.position,ins)

i add this code to root object for spawn on click position.
but sprite shifted from click position.

i seem event.position for absolute position on screen.
but set_position function is for relative position from root.

can i convert event.position to relative position?
Is there an option to set set_position to an absolute position?

extends Node2D

var path = load("res://0_practice_folder/add_mesh_2d/Sprite.tscn")
var ins
var v_rect
	

func _input(event):
	if Input.is_mouse_button_pressed(BUTTON_LEFT):
		v_rect = get_viewport_rect().size
		ins = path.instance()
		ins.set_position(event.position - v_rect/2)
		self.add_child(ins)

this code work well.
is this way correct?

bgegg | 2019-06-23 10:15