Skip to content

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

@AdriaandeJongh

Description

@AdriaandeJongh

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 monstrosity of a chart and become completely paralyzed:

Image

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 InputEvents, 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:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions