Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Ilya | |
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?