X Tutup
Skip to content

Movement doesn't work as expected when mapping keys and axes to the same action #45628

@mapedorr

Description

@mapedorr

Bugsquad note: This issue has been confirmed several times already. No need to confirm it further.


Godot version:
3.2.4.rc1.official

OS/device including version:
Windows 10 (19042.746)

Issue description:
When I plug in a PS4 controller, KinematicBody2D doesn't move properly while using the d-pad buttons or the keyboard. Same occurs if I use DS4Windows to emulate a Xbox 360 controller (XInput).

(!) Note The same code works fine in Godot v3.2.3.stable, both for the PS4 controller (with and without DS4Windows) and the keyboard.

func _physics_process(delta):
	velocity = get_direction() * speed
	velocity = move_and_slide(velocity)


func get_direction():
	var dir: = Vector2.ZERO
	dir.x = Input.get_action_strength("move_right") - Input.get_action_strength("move_left")
	dir.y = Input.get_action_strength("move_down") - Input.get_action_strength("move_up")
	dir = dir.normalized()
	return dir

Steps to reproduce:

  1. Open and run the attached project with a PS4 controller connected.
  2. Move the rectangle on the screen using WASD or the arrow keys, then try to move it using the d-pad buttons.
  3. The node's movement shouldn't work properly, neither with the keyboard or the controller.
  4. Disconnect the controller and the rectangle will move without problems using the keyboard.

Repeat steps 1 and 2 in Godot v3.2.3.stable.official and the rectangle will move without problems.

Here you can see how the gamepad registers the buttons pressing without moving the rectangle, same for WASD and arrow keys.

Minimal reproduction project:

GamepadInputError.zip

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    X Tutup