Hello Guys,
I’m using jme-vehicles library in which vehicles response to WASDER key press.
When porting my game to Android, I created a small virtual joystick (see video below) and I would like to send key press events to JME whenever the user moves the joystick.
Can it be done?
Thanks!
I think all you need to do, is to create an interface of your own & attach an interface call to the location of your code in which you do the maths of stickBall constraints, I mean if the game stick already responds to touch events ( or mouse) then you can do this easily…
The interfaces may call the same code that the key pressors call…so why bother yourself stimulating the WASD & using more resources when you can call any code at any time.
There is no reason to fake keys… when all those keys are doing are mapping to functions registered to those mappings.
key → “some string” → doTheThing
Just change your virtual joystick to call “some string” or doTheThing directly. No reason to monkey with complicated Rube-Goldberg machines.
OK. I think I found the correct method for me. The vehicle’s InputState observes the joystick signals and manages a SignalTracker (which also serves the key press input).
So, in short the vehicle’s SignalTracker gets its state either from the Android virtual joystick or from the physical keyboard. It seems to work fine