Jumping weird behavior

Godot Version

v4.2.1.stable.official [b09f793f5]


Hi everyone I hope someone has a solution for this issue
in a 3D game.
I’ve set the Player movements through Input Map using both physical keyboard “arrow keys” and “AWSD”, and the jump is “Space”
jumping works fine in all directions and conditions EXCEPT when running left+forward arrows it just won’t jump.

extends CharacterBody3D

# How fast the player moves in meters per second.
@export var speed = 14
# The downward acceleration when in the air, in meters per second squared.
@export var fall_acceleration = 75
# Vertical impulse applied to the character upon jumping in meters per second.
@export var jump_impulse = 25
# Vertical impulse applied to the character upon bouncing over a enemy in meters per second.
@export var bounce_impulse = 16

# animation controllers
@onready var anim_tree = $Pivot/StuntCharacter/AnimationTree
@onready var anim_state = $Pivot/StuntCharacter/AnimationTree.get("parameters/playback")

signal hit

var target_velocity = Vector3.ZERO
var jumping = false
var last_floor = true

func _physics_process(delta):
	# We create a local variable to store the input direction.
	var direction = Vector3.ZERO

	# We check for each move input and update the direction accordingly.
	if Input.is_action_pressed("move_right"):
		direction.x += 1
	if Input.is_action_pressed("move_left"):
		direction.x -= 1
	if Input.is_action_pressed("move_back"):
		direction.z += 1
	if Input.is_action_pressed("move_forward"):
		direction.z -= 1
	if direction != Vector3.ZERO:
		direction = direction.normalized()
		# Setting the basis property will affect the rotation of the node.
		$Pivot.basis = Basis.looking_at(direction)
	# Ground Velocity
	target_velocity.x = direction.x * speed
	target_velocity.z = direction.z * speed
	# Vertical Velocity
	if not is_on_floor(): # If in the air, fall towards the floor. Literally gravity
		target_velocity.y = target_velocity.y - (fall_acceleration * delta)
	# Jumping.
	if is_on_floor() and Input.is_action_just_pressed("jump"):
		target_velocity.y = jump_impulse
		jumping = true
	if is_on_floor() and not last_floor:
		jumping = false
	last_floor = is_on_floor()
	# Moving the Character
	velocity = target_velocity
	var switch = Vector2(velocity.x,velocity.z).length()

func die():

func _on_enemy_detector_body_entered():

Without code or a minimal reproduction project will be hard to help


It may be related to your keyboard. A keyboard is often wired strange, to keep production costs low, so that some combinations result in ghosting or jamming. Depends on the keyboard though.
You can use xev/wev/libinput debug-events on Linux/BSD/GNU-OS, don’t know about other systems. You can read about this topic here (or anywhere else, is a common issue).

If I understood correctly, using WASD works?

yes WASD works as expected
the keyboard is Microsoft not fancy but not very cheap.
my OS is windows 10

the keyboard ghosting issue is interesting, but I can’t believe it’s happening with just 3 keys specially as commonly used as the arrow keys and space bar
any ways I’ll try to send the game to some friends to test it on their keyboards.

Does not matter how fancy or cheap it is. You have to choose between one of the two. On custom made keyboards you often have an additional amount of diodes (one for each key) to control it better. The rest happens in the controller-code of the keyboard. And of course we often have usb instead of ps/2 and usb is heavily limited directly compared. On Laptops we often have an ic2 controller too. But thats to specific for now.

Choose another application where you can use both arrow keys and space and see if it works there while pressing them together. Another game maybe.
You can also log what Godot gets using something like

func _input(event):
	if event is InputEventKey:
1 Like

Thanks for your help, I tried other keys and it’s working fine, so I’ll have to keep trying fixing this issue and testing it on other PCs or else I may opt out the arrows and stick with WASD only.