Hello, I am trying to get mouvement with the keyboard for a azerty mapping. I see that the FirstPersonController bundled script uses the CameraController which checks for the variable arm_azerty before mapping the keys.
I guess I can remap the keys in the CameraController file but this would not be nice, my attempts to set arm_azerty in the Main.hx failed because it is auto generated and so resets before compiling. Declaring it alongside the key mapping (right before it, in CameraController.hx) fails also: it compiles and runs but doesn’t care about the newly ‘var arm_azerty = true;’.
So where do I have to set this arm_azerty variable so that the macro takes it into account ? And what would be the way to make this setting optional via a game menu ? Thanks in advance !
#if arm_azerty
and other #if arm_*
are conditional compiling flags that are added to the project by the engine when building your project (here and that particular flag here if you are curious).
You could probably have in your script something like in the CameraController, after all those are inlines variables of type String:
#if arm_azerty
static inline var myKeyUp = "z";
static inline var myKeyDown = "s";
static inline var myKeyLeft = "q";
...
#else
static inline var myKeyUp = "w";
static inline var myKeyDown = "s";
static inline var myKeyLeft = "a";
...
#end
or you could use a bool variable affected by this conditional compiling that you can then change with some settings if you will:
#if arm_azerty
public var isAzerty = true;
#else
public var isAzerty = false;
#end
if (isAzerty) { ... }
I would like to set this through the ui, through your link I see that there is a viewport_controls parameter that needs to be set to ‘azerty’ but I don’t know how to do so.
What would mean “by the UI”? in Blender or inside your game?
If you meant through Blender it seems it checks what you selected in the Viewport Controls
option in the preferences of the armory add-on.
But if you meant control it over your game then you can simply set a custom variable depending of input from the player through the UI, there is a few tutorials on that I think https://github.com/armory3d/armory/wiki/community_tutorials https://blackgoku36.github.io/armory-tutorials/#/docs/Basics/Canvas
Yes I meant in Blender like in the picture, this solves the issue thank you.