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
- Update X11 global mouse position at startup When we start the engine we haven't yet gotten any X11 motion events so we don't yet know where our mouse cursor is located. Instead we now query the X ser... — committed to hpvb/godot by hpvb 6 years ago
- Update Windows global mouse position at startup Fixes issue #8145 for Windows, in the same manner as issue #21910 fixed it for X11. — committed to serados/godot by serados 5 years ago
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)