0 votes

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():
    pass

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)
in Engine by (51 points)
edited by

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.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.