godotengine / godotengine/godot-docs

Add examples for common coordinate conversions (a.k.a. Godot 2D coordinate system is incomprehensible)

Open
#11,846 1 comment 3 reactions 0 assignees View on GitHub
enhancement topic:2d topic:input
Dominant language
reStructuredText
Stars
5.7k
Forks
3.8k
Avg merge
1d 20h
Merged PRs (30d)
25

Description

**Your Godot version:** 4.6

**Issue description:**
I've been in games for 15 years and somewhat used to having different coordinate systems for viewports, UI, and world space. But when I have to do any conversions between coordinate systems in Godot, I land on [this](https://docs.godotengine.org/en/stable/engine_details/architecture/2d_coordinate_systems.html#godot-2d-coordinate-systems) monstrosity of a chart and become completely paralyzed:

![Image](https://github.com/user-attachments/assets/4ab5d43e-bfca-415c-9e30-6dcf016dbd87)

Right, so, it's complicated, and probably for good reasons! However, that is not generally the experience of the average game developer using Godot; they'll work in a 2D or a 3D scene or in a UI scene and generally don't have to deal with any of that complexity. But then there are moments, eg. when working with `InputEvent`s, where users are forced into working with / understanding this complexity, and the documentation fails to bridge the gap between the 'simple' context of the scenes, and the extremely complicated context of the internal coordinate systems of the engine.

I found a few other pages (links at the bottom) that all fail to address some common coordinate system conversions. The documentation desperately needs to bridge this knowledge gap.

**Some ideas for improvements:**

- Add an example of how to convert input position to the coordinate system of a simple 2D scene.
- Add a table with on both axis a few common coordinates (eg input_event.position, node_2d.position, control.position) and how to convert to every other coordinate.
- Improve the monster chart to be clearer on what functions to call from where to get to the other coordinate.
- …

**URL to the documentation page:**
- Godot 2D coordinate systems: https://docs.godotengine.org/en/stable/engine_details/architecture/2d_coordinate_systems.html#godot-2d-coordinate-systems
- Viewport and canvas transforms: https://docs.godotengine.org/en/stable/tutorials/2d/2d_transforms.html#transform-order
- Mouse and input coordinates: https://docs.godotengine.org/en/stable/tutorials/inputs/mouse_and_input_coordinates.html

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.