+1 vote

I'm working on a pixel-art point and click, and I often have to place objects precisely (pixel-perfect) in the scenes, and I was wondering if there was a way to display the mouse cursor's position (x and y) in the 2D editor.
It would save me a lot of time !

in Engine by (188 points)

i don't think that is what he wants

No, I don't need the in-game position of the mouse, but the position of the mouse when using the editor, the same way you get the position of your cursor in the script editor in the bottom-right corner of the window.

1 Answer

+1 vote
Best answer

I'm afraid this isn't possible yet. Consider making a proposal over here.

Alternatively (if you don't mind the information being displayed in a dock) you could create an EditorPlugin to do what you want. Something like this:

extends EditorPlugin

var dock

func _enter_tree():
    dock = preload("res://addons/plugin/plugin.tscn").instance()
    add_control_to_dock(DOCK_SLOT_RIGHT_UR, dock)

func _input(event):
    var scene_root = get_tree().get_edited_scene_root()
    var mouse_coords = scene_root.get_global_mouse_position()
    dock.text = str(mouse_coords)

func _exit_tree():

where plugin.tscn is just a scene containg a Label-node, nothing else.

by (10,628 points)
selected by

Thanks a lot :)
I'm going to try to do that.

Did you ever end up finishing this plugin?

It's really annoying that the pixels positions are not displayed by default in Godot when working in low-resolution games.

For godot 3.5 (and maybe earlier versions too)

Replace :

dock.text = str(mouse_coords)

With :

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 Frequently asked questions and 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 [email protected] with your username.