I want to rebind up and down fly keys from q and z to space for up and shift for down. The problem is that I don’t know what is the mapping name for up and for down.
To delete the input I would use: inputManager.deleteMapping(""/Mapping name goes in there/);
But how to add new binding then? That’s also a thing I would be pleased if someone helped me with.
Now after a bit of thinking, I figured out that it would be best to just clear all keys and try implementing flying myself… Although I still think that it would be the best just to rebind those keys if that is even possible.
After finding this piece fo code in FlyByCamera.java:
// keyboard only WASD for movement and WZ for rise/lower height
inputManager.addMapping("FLYCAM_StrafeLeft", new KeyTrigger(KeyInput.KEY_A));
inputManager.addMapping("FLYCAM_StrafeRight", new KeyTrigger(KeyInput.KEY_D));
inputManager.addMapping("FLYCAM_Forward", new KeyTrigger(KeyInput.KEY_W));
inputManager.addMapping("FLYCAM_Backward", new KeyTrigger(KeyInput.KEY_S));
inputManager.addMapping("FLYCAM_Rise", new KeyTrigger(KeyInput.KEY_Q));
inputManager.addMapping("FLYCAM_Lower", new KeyTrigger(KeyInput.KEY_Z));
in simpleInit the FlyCamAppState might not be initialised, so the mapping doesn’t exist yet.
you can either remove it once in the simpleUpdate but that’s a bit ugly.
Or create your own appState that does the work :
Create an appState that extends FlyCamAppState
just implements the initialize method like this
public void initialize(AppStateManager stateManager, Application app) {
super.initialize(stateManager, app);
//remove old mapping , create the new ones
}