The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

0 votes

I've been trying to tackle this issue from a design perspective, and I am not clear if the approach I have in mind is the most efficient given the feature set of other components like InputMap.

The current approach I had in mind was to use various InputEvent tracking to pull the value of the scancode, assign it to a Singleton object, and then listen for that scancode to be thrown in another InputEvent elsewhere in the game.

Does this sound like a scalable solution? When I looked at Input Map, the documentation implied that once its set, its not possible to edit. Also, is there a reason why the scancode value returned in an InputEvent doesn't match the set constants for the key in @Global?

Just looking for feedback here. Thanks!

in Engine by (62 points)

InputMap already allow to add, modify and remove actions (is what the editor do), there is a official demo about input mapping you can check.

1 Answer

0 votes

I am not sure why you want to check scancodes, for hard coded binding ?
Check this part for setting a default mapping : http://docs.godotengine.org/en/stable/learning/step_by_step/simple_2d_game.html#input-actions-setup

And you can edit InputMap programmatically : http://docs.godotengine.org/en/stable/classes/class_inputmap.html

by (340 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.