0 votes

Here is my function:

func define_keybindings():

# directional keys
var _left = InputEventKey.new()
InputMap.action_add_event("ui_left", _left)
var _right = InputEventKey.new()
InputMap.action_add_event("ui_right", _right)
var _forward = InputEventKey.new()
InputMap.action_add_event("ui_up", _forward)
var _back = InputEventKey.new()
InputMap.action_add_event("ui_down", _back)

# mouse wheel
var _zoom_in = InputEventKey.new()
InputMap.action_add_event("ui_page_up", _zoom_in)
var _zoom_out = InputEventKey.new()
InputMap.action_add_event("ui_page_down", _zoom_out)

It works perfectly for KEYn but fails for MOUSEBUTTONWHEELUP / DOWN

Any insights would be appreciated, thank you.

Godot version 4 beta 4
in Engine by (14 points)

1 Answer

0 votes

Most likely due to those not being InputEventKeys

# mouse wheel
var _zoom_in = InputEventMouseButton.new()
InputMap.action_add_event("ui_page_up", _zoom_in)

var _zoom_out = InputEventMouseButton.new()
InputMap.action_add_event("ui_page_down", _zoom_out)
by (6,876 points)
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.