Input.get_vector() may not work properly in 4.6

Godot Version

Godot 4.6

Question

Hi, I just updated to Godot 4.6 and it seems to break my character controller when using Input.get_vector(). The game registers the inputs of my control scheme (it knows when I’m pressing the assigned action to the control) but the vector from the function is always 0 when pressing WASD.

If I set the deadzone to 0.0 and I use a controller, it detects it sometimes but is not consistent at all.

Also, when using

Input.get_action_strength("forward")

it always returns 0.0 from my keyboard.

In a new project it returns 1.0, so it isn’t my keyboard or Godot itself (I think).

What could be causing this?

What inputs are your movement actions mapped to?

My inputs are mapped like this:

And I just discovered that these more or less work (still investigating).

What doesn’t work are inputs mapped by code from a config file that I use to let the user remap the control scheme (which is weird because it has always worked through various versions of Godot).

These are, for example, the methods I use for loading the keyboard and mouse settings.

func load_keybindings():
	var keybindings = {}
	var keys = config.get_section_keys("keyboard") #config is the file
	for key in keys:
		var input_event = load_single_keybinding(key)
		keybindings[key] = input_event
	return keybindings


func load_single_keybinding(action):
	var input_event
	var event_str = config.get_value("keyboard", action)	
	if event_str.contains("mouse_"):
		input_event = InputEventMouseButton.new()
		input_event.button_index = int(event_str.split("_")[1])
	else:
		input_event = InputEventKey.new()
		input_event.keycode = OS.find_keycode_from_string(event_str)
	return input_event

I found out the problem and I already fixed it!

I thought the problem was on the information I was saving from the player because I couldn’t get whether the key was Physical or not and maybe the new Godot version required it.

It is way dumber than that.

Every time I was moving my character, the game tried to reload the file that contained those settings, and now it seems that opening a file may work different because it blocked the movement of my character, maybe because I was reloading those settings with every input.

Thank you so much for the help, I really panicked for a second here :sweat_smile:

1 Like