So for the mmorpg that I have under developement, I want to make it compatible with modern gamepads. However, I do not know where a library for that sort of thing is or how to implement it in a PlayCanvas project. Any help is appreciated!
Gamepads are supported by PlayCanvas based on this documentation
I know there used to be a tutorial for gamepad inputs, but I can’t find it now
This supports Xbox and Dualshock (PlayStation) controllers correct?
It uses GamePad Web API, whatever it has support for, it will work.
Generally all “normal” gamepads are supported.
I see it is a Mozilla api. Found the page for it on their website. Thanks for the help!
It is not Mozilla API (there is no such thing as mozilla api), it is W3C Working Draft - means it is not yet by W3C finalised to be implemented by all browser vendors, but they are still free to implement it.
https://www.w3.org/TR/gamepad/
Hi,
Max is right about browser vendors so be prepared for changes API. A short while ago chrome experimental supported vibration and then it was removed not long after which broke a couple of projects I was working on. When dealing with the W3C API it’s sometimes a good practice to check for the existence of something before attempting to use it.
e.g. For example
if (gamepad.vibrate) { gamepad.vibrate(100); }
that way if the browser doesn’t support it then at least the code doesn’t break.