Jumping with a controller isn't working

Using godot 4.2.2

When using keyboard the jumping works perfectly but just isn’t with a controller and the input and everything is all set up fine i see no reason it wouldn’t work

Here’s the code handling the jump i can send the rest of the player script if necessary

func _unhandled_key_input(event):

	if event.is_action_pressed("jump"):
		if $RayCast3D.is_colliding() or wallstick == true:
			apply_central_impulse(Vector3.UP * 16.0)
			self.gravity_scale = 3.5
			can_dash = true
			jumped = true
			wallstick = false
			if isCrouching == false:
				playback.start("Jump")
				
		elif jumped == true:
			if isCrouching == false:
				if doublejump == false:
					playback.start("Double Jump")
					apply_central_impulse(Vector3.UP * 16.0)
					self.gravity_scale = 3.5
					doublejump = true

The problem seems to be that you are using _unhandled_key_input(event) this only triggers for keyboard inputs: InputEventKey — Godot Engine (stable) documentation in English

You will want to use _unhandled_input(event) instead and check if the event is a keyboard or joypad event: Using InputEvent — Godot Engine (stable) documentation in English

1 Like

Thanks so much for the help that worked, it’s embarrassing how long it took me to figure it out

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.