How to set node position on screen?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Sprowk
:warning: Old Version Published before Godot 3 was released.

I have a character (platformer) which moves with the camera. When i open box and drag item from it. I want to move the node to mouse pos. How to do this with moved camera?

func _input(ev):
   if ev.type == InputEvent.MOUSE_MOTION:
      self.set_pos(ev.pos+some_pos)

What should some_pos be in this case? Or as heading says is there any function like that?

:bust_in_silhouette: Reply From: Kamil Lewan

I’m not sure what you’re asking about… When you want set position of node to mouse position you may use get_global_mouse_pos() or get_local_mouse_pos()(e.g on Camera2D) in CanvasItem class. What’s wrong with just set_pos(ev.pos)? Btw. self here is not necessary.