Hi all,
I have a question with regards to setting up binds for different keyboard layouts (AZERTY, QWERTZ, DVORAK) on Win64 builds.
As far as I can tell, there is no way to bind to scan codes in Unreal to have consistent physical layout (e.g. WASD in qwerty, ZQSD in azerty). Additionally, things like numeric keys don’t function out the box as the bindings only listen to the digit value, but the OS maps the key to the shift-modified value by default in azerty.
I have tested Fortnite and as far as I can tell it behaves the same as vanilla Unreal, e.g. there are no specific keyboard layout specific bindings to handle users with different layouts.
Do you have a recommendation on how to handle this? I do have a rough implementation which kind of works:
- I create an input pre processor (IInputProcessor) to override HandleKeyDownEvent / HandleKeyUpEvent.
- These events map from the system layout (e.g. user’s defined layout such as azerty), and these get mapped into qwerty land and sent through the engine.
- This is done by converting from system -> scan code, then from scan code -> querty key.
- This is done by creating mapping tables using MapVirtualKey win32 api method to create mapping tables from Virtual key to scan code and scan code to virtual key for standard qwerty layout, and the user’s active layout.
- I also have created a blueprint function library to do the reverse mapping (qwerty to system layout). We can use this in the widget blueprint code to display the key prompts in the user’s current keyboard layout.
This means that we can config our game assuming qwerty. The user’s input is remapped to qwerty, and our qwerty UI prompts are mapped to the user’s layout.
This kind of works, but it all feels like a massive hack. It feels like I’m going against the grain here and fighting with the editor.
Am I missing something here? Is there a way to achieve what I want with vanilla Unreal? If not, are there any plans to support something like binding to scan codes to allow us to specify a physical location on the keyboard for the binding data rather than relying on keyboard layout and OS mappings?
Cheers!
-Steven
[Attachment Removed]