godot: Mouse Position is unknown until first mouse event

Operating system or device - Godot version: Linux - Godot master (468719)

Issue description: If you neither click nor move the mouse, get_global_mouse_pos wil return (0,0). Related to #8136.

Steps to reproduce:

extends Node2D

func _ready():
    print(get_global_mouse_pos()) # 0,0

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 23 (21 by maintainers)

Commits related to this issue

Most upvoted comments

Should now work on Windows and Linux, only macOS left.

Can confirm on Windows 10, with stretch mode disabled. Stretch mode 2D gives a different output for both local and global: (-1.#IND,-1.#IND) Viewport mode is not working but it shows 0 or -1.#IND on the output on different aspects.

Going to work on a solution for macOS

I’m getting this issue on Mac, with Godot 3.0.2. (Running MacOS 10.11.6)