Coordinates of the mouse cursor in 2d editor

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

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 !

Mouse and input coordinates — Godot Engine (stable) documentation in English

is this what you want?

RedBlueCarrots | 2020-08-24 07:14

i don’t think that is what he wants

mdubaisi | 2020-08-24 07:22

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.

IvanVoirol | 2020-08-24 08:02

:bust_in_silhouette: Reply From: njamster

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.

Thanks a lot :slight_smile:
I’m going to try to do that.

IvanVoirol | 2020-08-24 19:58

Did you ever end up finishing this plugin?

ccpixel | 2022-01-03 21:08

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

jeancallisti | 2023-01-07 16:55

For godot 3.5 (and maybe earlier versions too)

Replace :

dock.text = str(mouse_coords)

With :


jeancallisti | 2023-01-07 17:05

There is a Ruler Mode (R). it can be used to measure distance and angles but when you click it will display the coordinates and it is the easiest solution I have found.

1 Like