+5 votes

How do you get the mouse position relative to the scene offset and not the window offset ?

in Engine by (117 points)

2 Answers

+5 votes

You can use get_local_mouse_pos() from CanvasItem class.

by (801 points)
+1 vote

just call

get_viewport().get_mouse_pos()

for more detail
http://docs.godotengine.org/en/latest/tutorials/engine/mouse_and_input_coordinates.html

by (485 points)
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.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.