xiphiaz Posted January 9, 2018 Share Posted January 9, 2018 Hello, 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? Quote Link to comment Share on other sites More sharing options...
RaananW Posted January 9, 2018 Share Posted January 9, 2018 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 Quote Link to comment Share on other sites More sharing options...
RaananW Posted January 9, 2018 Share Posted January 9, 2018 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. brianzinn 1 Quote Link to comment Share on other sites More sharing options...
xiphiaz Posted January 11, 2018 Author Share Posted January 11, 2018 Thanks @RaananW for raising the issue, I did end up doing exactly as you described, however I agree with the issue you raised that ideally there would be a Babylon way to do this. GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.