1glayfan Posted February 7, 2018 Share Posted February 7, 2018 Hello, I am using the WinMR controllers, and basically trying to read input of the touchpad (big round button) I am intending for the user to hit either top, bottom, left or right part of the button, basically for navigation purpose. Here are the test codes that I wrote: controller.onTouchpadButtonStateChangedObservable.add((gamepadButton: BABYLON.ExtendedGamepadButton, eventState: BABYLON.EventState) => { console.log('pressed=%s, value=%d', gamepadButton.pressed, gamepadButton.value); }); controller.onTouchpadValuesChangedObservable.add((stickValue: BABYLON.StickValues, eventState: BABYLON.EventState) => { console.log('x=%d, y=%d', stickValue.x, stickValue.y); }); I tried both observables just to see which one is the useful one. Although I am getting the callback, unfortunately the value gamepadButton.value and stickValue x and y are always 0, regardless which part of the button is pressed. I suppose we should be to distinguish which part (the top/bottom/left/right) of the button is being pressed, right ? Please help! thank you. Quote Link to comment Share on other sites More sharing options...
brianzinn Posted February 7, 2018 Share Posted February 7, 2018 Which controller are you using? Also, very noob question - how are you getting the console output? I have never tried to debug through Mixed Reality Portal - was curious how that was done or how you accomplished that. I'd like to try it out! Also, just looking through the source. Won't solve your touchpad issue, but are you getting trackpad Stick values through with onTrackpadValuesChangedObservable.add(...)? https://github.com/BabylonJS/Babylon.js/blob/master/src/Gamepad/Controllers/babylon.windowsMotionController.ts#L114 Quote Link to comment Share on other sites More sharing options...
1glayfan Posted February 8, 2018 Author Share Posted February 8, 2018 @brianzinn well I am using the winmr controller (made by Dell). I believe all controllers in winmr behave the same way. I do still need to hit F12 to see the console output while wearing the vr headset, yeah I had to kind of peek at the console. If you have better debug console for VR mode, please let me know. I just tried the onTrackpadValuesChangedObservable per your suggestion, the behavior is the same: always getting x=0 and y=0 regardless of how I pressed the button. The babylonjs doc does mention that that api is only an alias to the onTouchpadValuesChangedObservable, so I guess this is why. From http://doc.babylonjs.com/how_to/webvr_camera: .... Touchpad axis - axis values. Mapped to onTouchpadValuesChangedObservable and onTrackpadValuesChangedObservable (aliases). Quote Link to comment Share on other sites More sharing options...
brianzinn Posted February 8, 2018 Share Posted February 8, 2018 Thanks. I'll try in a few hours. edit: I am at least getting trackpad value {x, y}. here is my playground (I'm using console.dir as it appears I cannot inspect objects after the fact): https://playground.babylonjs.com/#IUUXNE#1 Here is a screenshot: To get touchpad values I would hope for a better debug experience. that is really awkward! I would expect all WMR devices are the same as well. Cheers. 1glayfan 1 Quote Link to comment Share on other sites More sharing options...
Guest Posted February 8, 2018 Share Posted February 8, 2018 hey guys! let me know if you think this is a bug Pinging @trevordev FYI Quote Link to comment Share on other sites More sharing options...
1glayfan Posted February 8, 2018 Author Share Posted February 8, 2018 Here is my playground for this issue: http://playground.babylonjs.com/#M5XR49#6 You will get the callback if you hit the winmr controller's touchpad (big round button) but alas the reported values (x, y, values etc) are always the same: zeroes. Quote Link to comment Share on other sites More sharing options...
Guest Posted February 9, 2018 Share Posted February 9, 2018 Ok tracking it here: https://github.com/BabylonJS/Babylon.js/issues/3734 1glayfan 1 Quote Link to comment Share on other sites More sharing options...
1glayfan Posted February 12, 2018 Author Share Posted February 12, 2018 @Deltakosh @trevordev Sorry this is a false alarm, The onTouchpadValuesChangedObservable is actually working, it's returning value between -1.0 to 1.0 for the x and y and I was formatting the value incorrectly (truncated to zero). Here is the updated playground: http://playground.babylonjs.com/#M5XR49#14 However, the onTouchpadButtonStateChangedObservable is still returning zero for the value btw. Is this actually expected ? Quote Link to comment Share on other sites More sharing options...
Guest Posted February 12, 2018 Share Posted February 12, 2018 Nope it is not Updated issue: https://github.com/BabylonJS/Babylon.js/issues/3734 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.