Input of "Q" and "Q + CTRL" registered together, help!

Godot Version

4.6

Question

Hi,

I have the following set in input map:

The problem is, why does godot activate rotate left and right when ctrl and shift is being pressed?
Is this a bug?

Should they not registered as different input key/action?

Can anyone try it out?

Any help appreciated!

Please share the code where you use these inputs. It’s impossible to tell whether your problem is with the input map or your code unless we see the code.

Pressing CTRL + Q does also press Q, so Godot will register both events. As a default it’s nice since we can add shift to sprint without breaking all other inputs.

You can check if an action is exactly pressed in your input function using the third optional argument of is_action_pressed

func _unhandled_input(even: InputEvent) -> void:
    if event.is_action_pressed("Rotate Left", false, true):
        print("Only rotate left!")

Previous post on a similar subject:

Hi,

Thank you for your reply.
I am using: Input.get_axis(“Rotate Left”, “Rotate Right”)

I do not see an option for exact match.

Do you have any advice?

Thank You!

You may have to expand the function to it’s mathematical equivalent, exact_match ought to be added in a later version.

func get_axis_exact(negative: String, positive: String) -> float:
    var n: float = Input.get_action_strength(negitive, true)
    var p: float = Input.get_action_strength(positive, true)
    return p - n

Thank you!
That works!

I end up with the following code: rotate_input_direction = Input.get_action_strength(“Rotate Right”, true) - Input.get_action_strength(“Rotate Left”, true)

Once again, thank you!