javalang 87 Report post Posted December 6, 2018 Hello everybody, I'm looking fore some advice using a PS4 (DS4) Contoller for mobiles. So far I've found at least one PLAYGROUND where the camera zoom is responding to my Controller keys. But I have no idea which type of WebVRController is instantiated and how the key-mapping happens (I'm not fit in debugging mobile applications) . Maybe there is one specific WebVRController already implemented or is the Generic type the right one? Does someone have experience with this topic? My hardware conection: Dualshock controller (DS4) paired with an android mobile. Thanks in advance Quote Share this post Link to post Share on other sites
Deltakosh 4315 Report post Posted December 7, 2018 Pinging @trevordev Uneducated guess: It is using the regular Gamepad controller (https://doc.babylonjs.com/how_to/how_to_use_gamepads) Quote Share this post Link to post Share on other sites
javalang 87 Report post Posted December 7, 2018 Thanks @Deltakosh, but I'm afraid there is no VRController involved. I think it's just a key emulation like the UP/dn/left/right keys on a pc-keyboard which is active if I pair the contoller with the mobile. Anyway, I will follow the description of "how to use gamepads" to see if any of the methods will be called... Quote Share this post Link to post Share on other sites
trevordev 148 Report post Posted December 7, 2018 @javalang When I've done controller work in the past, I've tested using http://html5gamepad.com/ . If it doesn't show up there, there's probably a connection issue. If it does show up there than it should work with Babylon's "how to use gamepads" api's, if it doesn't it's likely a button layout issue, if thats the case, I might fallback to using html5 gamepad api's directly . Quote Share this post Link to post Share on other sites
javalang 87 Report post Posted December 7, 2018 @trevordev Thanks for the reply, I also did some tests with html5gamepad but on the PC side. My interest is on the mobile side and it's very difficult for me to see what's going on. I just started an android app "Gamepad Tester" where I can see that most of the buttons are working well including Joysticks and X/Y buttons. But this app is for sure a native app and probably not using the html5 interfaces. Can you give me a hint how to find out the supported or connected controllers? Is "VRHelper.onControllerMeshLoaded.add(onControllerAttached);" the only way I can log the existence of a controller? And another question: I don't understand why the "onControllerAttached" callback has something to do with a loaded Mesh, what is if I have no Mesh to load? Thanks again for your help Quote Share this post Link to post Share on other sites
javalang 87 Report post Posted December 7, 2018 @trevordev about html5gamepad: on the android mobile there are no buttons reacting at all! Only the website itself is scrolling if I press the navigation keys. So I have to figure out first this problem first, maybe my controller isn' t supported to use with the html5 spec. Quote Share this post Link to post Share on other sites
brianzinn 373 Report post Posted December 7, 2018 I've played around with the GamePad API for GearVR and Daydream controllers and after figuring out how to debug them the coding part was easy. The gamepad API you can check yourself what is being returned. Looks like your controller is not supported by gamepad API, based on what you are saying though. Do you get any devices returned at all when connected? Check out this post for how to debug Android devices (over USB or WiFi). Very useful for figuring out what is happening with gamepad Quote Share this post Link to post Share on other sites
javalang 87 Report post Posted December 7, 2018 @brianzinn thank you for the link, I tried your method today but unfortenately after some debugging my bluetooth connection was corrupted and I gave up, I will give another try. Quote Do you get any devices returned at all when connected No I don't, but this is probably because the gamepad API is event-driven (so far I've seen) and the controller is already connected (paired) over bluetooth. Quote Share this post Link to post Share on other sites
javalang 87 Report post Posted December 8, 2018 It was soo simple -> I didn' realize that chrome also have a develpment-browser version for mobiles (chrome-Dev) , I installed the browser and enabled the chrome://flags: WebVR and Gamepad extensions ->voila Gamepad Tester is running using DS4 wireless on the mobile. BTW, the DS4-controller on the PC (connected via USB) is recognized as BABYLON.GenericPad Now I'm going to figure out which type of controller is attached to the mobile, it's neither a BABYLON.Xbox360Pad nor a BABYLON.GenericPad. There is a controller connected but I have to do some debug now. Thanks for helping me and I hope this info is useful for another people. Quote Share this post Link to post Share on other sites
javalang 87 Report post Posted December 8, 2018 OK, last message, the DS4 Controller is mapped as a BABYLON.GenericPad and has the id: Wireless Controller (STANDARD GAMEPAD Vendor: 054c Product: 09cc). The image below shows the button values. Would be fine if someone creates a class for this widespread controller Quote Share this post Link to post Share on other sites