Jump to content

How can I register a custom gamepad


Recommended Posts



I'm attempting to implement support in my scene for navigating with a 3dconnexion spacenavigator, which has 6 axes. I can see it successfully registers as a gamepad, and can see four of the six axes bound to the "leftStick" and "rightStick" attributes, however I of course need the extra two axes.

I thought about creating a new `3dConnexionGamepad extends BABYLON.Gamepad` class, however I can't think of a way to get the `GamepadManager` to create an instance of my custom class. Is this possible? If not is there a workaround like mabye binding to the `.update()` method of the gamepad instance?

Link to comment
Share on other sites

Interesting (and important) question!

You are totally right, the gamepad manager doesn't allow it. I am creating an issue for this, let me see how we can solve this in the best way. My best suggestion currently is to allow setting the number of axes on the Generic gamepad. Will keep you updated here :)


Link to comment
Share on other sites

Issue was created - https://github.com/BabylonJS/Babylon.js/issues/3514 

Just wanted to note, that you can always access gamepad.browserGamepad.axes[0..5] (gamepad being Babylon's generated gamepad object) to get the current data from the 6 axes you have. This is a low-level solution, with no (babylon-)events fired. You could run a beforeRender loop to read the values, and do whatever you want with them.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...