Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Deith |
So the default setup has some issues with inputs stoping when an action is assigned to multiple inputs, described here: #48180 #45628 and I’m trying to figure out a workaround for movement. I’ve made separate key binds for directions for keyboard and for gamepad. And just coded it in the most straightforward way:
var direction = Vector3.ZERO
var gamepad = Vector3.ZERO
var keyboard = Vector3.ZERO
gamepad.x = Input.get_axis("ps_left", "ps_right")
gamepad.z = Input.get_axis("ps_up", "ps_down")
keyboard.x = Input.get_axis("ui_left", "ui_right")
keyboard.z = Input.get_axis("ui_up", "ui_down")
if gamepad.x != 0: direction.x = gamepad.x
if gamepad.z != 0: direction.z = gamepad.z
if keyboard.x != 0: direction.x = keyboard.x
if keyboard.z != 0: direction.z = keyboard.z
It works but it doesn’t feel very clean. I should probably just leave it like that since it works, but I feel like there’s some clever way of doing it that I don’t know.