GamePad aren't added to gamePadArray

finaly get most input working :smiley:

prototyping a simple tower defence game:

Play
Project
Editor

StartMenu.prototype.initialize = function() {
    this.app.keyboard.on(pc.EVENT_KEYUP, this.onKeyUp, this);

    **var gamepads = new pc.GamePads();**
**    var pads = gamepads.poll();**
   
    this.entity.findByName('ImageTouch').findByName('Disabled').enabled = !pc.platform.touch;
    this.entity.findByName('ImageKeyboardLeft').findByName('Disabled').enabled = !pc.platform.desktop;
    this.entity.findByName('ImageKeyboardRight').findByName('Disabled').enabled = !pc.platform.desktop;
    this.entity.findByName('ImageMouse').findByName('Disabled').enabled = !pc.platform.desktop;
    **this.entity.findByName('ImagePad1').findByName('Disabled').enabled = pads.length == 0;**
**    this.entity.findByName('ImagePad2').findByName('Disabled').enabled = pads.length < 1;**
    this.entity.parent.findByName('offence').enabled = false;
    this.entity.parent.findByName('defence').enabled = false;
};

I’m using two different PS3 controller. Win11, Chrom and Edge detect them correct…
tested on https://github.com/playcanvas/engine/blob/master/src/input/game-pads.js
both are just fine

and http://html5gamepad.com/
i’ve tryd Zombie Pac Man doesnt work :frowning:

gamePads are inabled in PlayCanvas settings

I can’t see how you are using gamepads in the project?

Here’s a really simple project on how to access the gamepads in PlayCanvas: Gamepad API not working in Chrome - #6 by yaustar

1 Like

Hi @Gurki,

I can gamepads being enabled in your PlayCanvas project settings, and testing in console I can see my gamepad attached.

Are you using any gamepad input logic in your project?

1 Like

For now I’ve tryed only to deteced, if there are any gamepads pluged in, and show this in the options for input. When thats working I’ll extend the keyboard input handle them as if gamepad buttons where simply keyboard buttons…

is navigator.getGamepad() browser specific?

image

yeah . progress :partying_face:

Solved

image

both gamepads detected :hugs:

1 Like