The Right Trick for the Flight Stick

Hi gang, time for another stupid Wingnut contemplation.

Has anyone ever used a flight stick… as a BJS-scene input device? Anyone know?

Perhaps flight stick events “travel the same trail” as game-pad events. (Wingy low-edu on this topic, and SO much more.) :slight_smile:

How about steering wheel controllers, with pedals?

Remember WAY back when they made one-handed mini-steering wheel controllers… about the size of trackball controllers? No? Me neither, but the link above looks interesting, and takes less desk-space than a steering wheel. :slight_smile: (I drive SLOW vehicles - MudRunner trucks) :slight_smile:

I know we have a brand new inputManager event-binder system. Maybe that is how we do our flight sticks, too. Thoughts? (thx)

I suppose the manufacturer’s flight stick config-software… is pertinent/important, somehow (converts flight-stick events… to allowed/common DOM events/keypresses? I’m SO unaware, hrmph.) In the description for that shuttle-knob thing above (one-handed steering wheel)… it says…

“Any application that uses key commands.”

Does that include browsers… with focused renderCanvas element, too? I would think so. But, that shuttle thing is a repeat-keypress-generator and NOT an analog potentiometer (pot)… which sort of sucks. I LOVE analog pots for vehicle steering… they have stop-points and can’t endlessly spin… just like a real steering wheel. But real steering wheels… about 5 complete turns… to turn wheels full-sweep? Not possible without a continuous-spin (shuttling) controller, I guess.

Remember the days of analog pots in joysticks? (Radio Shack Color Computer 2). The joystick never self-centers… fun! Push it 30% forward and 40% leftward, let go, and the joystick stays there. Cool.

It seems BJS/DK wants to stay out-of input devices hell, which I can understand completely. The new input-event-binder is a “shell”… a basic interface. I think it needs/invites fleshing-out… by ALL of us… as wanted. I wouldn’t mind offering players… flight stick control… for my Space Taxi 3D thing. Perhaps… all I need to do is honor hold-to-repeat keypresses in my game, and the flight-stick config software and its owner… take care of the rest. But I cannot change held-down-key… delay-before-repeating value… from within JS, right? That’s system level, me thinx. hmm.

Hey @Wingnut,

The inputManager and so on are all based on the browser gamepad APIs which if they are supported by the browser, would be supported in BJS. The force feedback vibration and specific behaviors as if I recall correctly the js spec never landed for those.

You might need to config a bit the binding but that should be it IF the browser supports it.

1 Like

Thx Bavvy! I tried it in a playground, with Firefox…

window.addEventListener("gamepadconnected", function(e) {
  console.log("Gamepad connected at index %d: %s. %d buttons, %d axes.",
    e.gamepad.index, e.gamepad.id,
    e.gamepad.buttons.length, e.gamepad.axes.length);});

info about gamepad api

Then I plugged-in a 15-year-old Saitek flight stick…

Console: Gamepad connected at index 0: 06a3-0006-CYBORG 3D USB. 18 buttons, 4 axes.

How cool is THAT!? 15 years old! Wow. ok, ok, I think we have some potential, here. Thx agn, @sebavan … nice lead… I’m on the road to more edu.

1 Like

Don’t know if you would count it as a flight stick, wingee, but once it arrives at my place then I will spent some time on getting this thingee working with the FlyCamera: :airplane:


https://game.watch.impress.co.jp/docs/20010416/jetcon.htm

I would be confident to be able to make a dedicated Gamepad class for it, but I am wondering how to get it properly inserted in the GamepadManager:

E.g. how to get a line added there that will dynamically do a ‘new MyAwesomeFlyControllerGamepad()’ based on the detected vendor and product id (these are supplied in the ‘gamepad.id’ string)?

I am thinking about some generic device filter JSON (on vendor and/or product ID) like they offer in HIDDevice API (Chrome) that would map filtered matches to dedicated Gamepad classes. Or the regex equivalent of the same.

This weight heavy controller is being shipped by sea mail so there is some time to think a nice solution out (as in, 2-3 months delivery time haha). :ship:

Q

1 Like

The good news, the above USB Gamepad device arrived last week… by boat :stuck_out_tongue: The shipping container full of fine Japanese import goodies was also stacked with the similar Playstation 1 / 2 version (which requires a PSX2USB adapter to use on PC).

It appeared there is no FlyCameraGamepadInput in the repo at all. So instead of a dedicated class for this Gamepad right now, I started writing a FlyCameraGamepadInput that would support regular Gamepad and also a dedicated version like this USB one.

Here’s today’s version:

FlyCameraGamepadInput | Babylon.js Playground (babylonjs.com)

It works very nice so far. Still want to find out a way to implement the banked turns, roll correction and have it support fly modes like ‘ghost’, ‘aircraft’ and ‘helicopter’. Also for the regular gamepad the right stick Y would make more sense over right stick X for jet engine thrust.