0 votes

You can get mouse position from the viewport, but how can you convert it to world position? Do I need to do it manually?

asked Jan 11 in Engine by mateusak (455 points)

1 Answer

0 votes
Best answer

If you want the mouse coordinates relative to your canvas, each Node2D inherits from a CanvasItem and gives a method called get_global_mouse_pos().

http://docs.godotengine.org/en/stable/classes/class_canvasitem.html#class-canvasitem-get-global-mouse-pos

answered Jan 11 by avencherus (2,075 points)
selected Jan 12 by mateusak
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.