Which _input function can process mouse "scroll factor"? (Invalid get index 'factor' on base: 'InputEventMouseMotion)

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By starzar

In Godot3.2(Windows 10/64bit) , on trying to trigger 3D movement with respect to the mouse “scroll factor” in both _input() and _unhandled_input() functions,the console gives the following error :-

Invalid get index 'factor' (on base: 'InputEventMouseMotion').  

No InputEventMouseMotion event is used in _input() but still console gives the above error.Which other _input function can process the mouse scroll factor?

extends Spatial

func _ready():

func _input(event):
	if event is InputEventMouseButton :
		print('event.factor = ' , event.factor)

#ERROR - Invalid get index 'factor' (on base: 'InputEventMouseMotion').     

#func _unhandled_input(event):
#	if event is InputEventMouseButton && event.button_index == BUTTON_WHEEL_UP || event.button_index == BUTTON_WHEEL_DOWN:
#		print('event.factor = ' , event.factor)

I cannot reproduce the problem (under Linux). Might be related to Windows? To be clear: which one produces the error, _input, _unhandled_input or both? The only issue I can spot is missing parenthesis in your _unhandled_input-condition, so even if an event is not an InputEventMouseButton the button_index is checked. However, that should result in a different error than the one you’re reporting here.

njamster | 2020-06-18 12:10