Input Handing and How do i use RawInputListener?

can jme listen to inputs other than those coming from keyboard/mouse/joystick? (i.e non-physical inputs)

for example, i want to trigger an action by setting a boolean flag. so if the boolean is true, then execute a certain set of instructions. so it’s like

inputManager.addMapping(“Left”, new KeyTrigger(KeyInput.KEY_J));

but instead of the KeyTrigger, i’m using a boolean to trigger the Left turn.

is this possible?

and if not, is RawInputListener of any use?

No to the first question… and RawInputListener doesn’t really help you either.

Why do you want to do this? Just curious. It seems like a long way around to go.

basically i’m doing a public bus service simulation, where i’m supposed to keep updating the bus’ movements. However the bus’ movements are not controlled using key presses or mouse actions. instead, another subsystem is passing in parameters to tell me when to turn the bus right or left etc, and the bus is supposed to respond accordingly.

what other alternative do I have?

Well, generally, I have my keys set values on something else that are then used to actually do movement. So if I wanted to control movement directly, then I’d just set values on those objects directly and bypass the keys altogether.

There may be a jme-friendly way of doing this with Controls or something… I’m not familiar with that stuff.

Someone else may pipe in now that the larger picture is understood.

yeah I was hoping there’d be a way to map those parameters to the actions.

otherwise i might have to keep polling for the inputs and then execute the actions accordingly… which wouldn’t be that efficient.

The jME input system just calls methods on your listeners when inputs are invoked. It doesn’t do anything special other than that. When your subsystem is telling you to turn right/left, you just do whatever you are doing in your input listeners.