Closed jonathanneels closed 6 years ago
Hi, sorry for the late reply. If I understand correctly, you want to duplicate, or override, the keyboard inputs right? The easiest way to do this is probably to directly manipulate the noa.inputs
object, which is an instance of this library. For example, the state variable controlling wither the "forward" input is active (i.e. the W key) is:
noa.inputs.state.forward
so you could set that to be true/false from an HTML button and it ought to work.
Let me know if I'm misunderstanding what you're asking...
That was exactly it!
I had found a (clumsy) solution in the form of ApplyImpulse...
Thank you very much!
Glad it's working!
Hi,
I would like to control the direction of the player through up, down, left and right. The movements work with keyboard bindings and I just don't get a coupling with html buttons to work (for mobile).
My alternative solution would be sending my flask server (python on android) the keyboard simulation command (get call), but that is overkill!?
I am aware client side js (key sim) is not allowed in browsers.
Please help with how I can make directional movement to work. In expanse a babylon gamepad could also be configured this way.
Thanks in advance!