Is there a way to get mouse coordinates like the image below, without referencing resolution?

  • xyz and synthnostate replied to this.
  • timoraes You want "OpenGL style" mouse coordinates? Just divide by window/viewport size etc, do the math. You might think this should be a Godot builtin but it's not needed by most games or internally. What you see in InputEventMouse is what you get.

    xyz Want to set object local position using this coordinates. I think this way is less complicated

    • xyz replied to this.

      timoraes What is "object local positioning"? It's also not clear from your drawing what those 1s represent? Window/screen border?

        get_viewport().get_mouse_position() ?

        timoraes You want "OpenGL style" mouse coordinates? Just divide by window/viewport size etc, do the math. You might think this should be a Godot builtin but it's not needed by most games or internally. What you see in InputEventMouse is what you get.

          xyz Position relative to parent...the number represent the x and y coordinates of the position

          • xyz replied to this.

            timoraes It gave an impression that you wanted normalized coordinates in range (0-1). If you just want coordinates relative to parent, you can call CanvasItem::get_local_mouse_position()