InputEventMouseMotion global_ relative_ not implemented?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Ilya
:warning: Old Version Published before Godot 3 was released.

Hi,

Trying to check mouse pos relative to the moving camera in the _input(e) loop, I’m getting all zeros for the global_ and relative_ member variables of InputEventMouseMotion

func _input(event):
	if event.type == InputEvent.MOUSE_MOTION:
		print("Global mouse: " + str(event.global_x) + ":" + str(event.global_pos.x))
		print("Relative mouse: " + str(event.relative_x) + ":" + str(event.relative_pos.x))
		print("Simple mouse: " + str(event.x) + ":" + str(event.pos.x))

The code above output:
Global mouse: 0:0
Relative mouse: 0:0
Simple mouse: 601:601

Am i doing something wrong or should I rely on get_global_mouse_pos() only?
Maybe there’s another way to cast node pos into screen (viewport) space instead?

:bust_in_silhouette: Reply From: Warlaan

I can’t confirm that the relative mouse position was always 0. It’s 0 quite often since it’s measured in pixels, so there will be moments where the position didn’t change for a whole pixel between two frames.

The global position however is 0,0 for me as well, but since every Control has the get_global_mouse_pos()-method that member might be deprecated.