Yea I’ll test this! I’m sure it will work too looks like it.
So perhaps we should make this remark to the Playcanvas folk on fixing it. Because that seems like a lot of extra code to make an already functional code for other keys.
I have a workaround actually for this, but was curious to why it was so difficult to implement. Thanks
So it seems that just basic functionality for gamepads that I use to use for older versions of PlayCanvas don’t work any more. Or maybe I’m missing something
I get an error that takes me to ‘isPressed’ and says it’s null :S not sure what’s going on but thought I’d let you all know. Would be great to get this to work for my game project!
Also is there a way to let playcanvas know if there are gamepads at all?
var Main = pc.createScript('main');
// initialize code called once per entity
Main.prototype.initialize = function() {
this.app.gamepads.deadZone = 0.1;
};
// update code called every frame
Main.prototype.update = function(dt) {
var gamepads = this.app.gamepads;
var x = gamepads.getAxis(pc.PAD_1, pc.PAD_L_STICK_X);
var y = gamepads.getAxis(pc.PAD_1, pc.PAD_L_STICK_Y);
if (x !== false && y !== false) {
console.log("x: " + x.toPrecision(3) + " | y: " + y.toPrecision(3));
}
};