Camera input null gamepad

Hi,

cameras created after createScene() have null gamepad - until the gamepad is disconnected and reconnected.
Quick look at how cameras are created, Babylon.js/freeCameraGamepadInput.ts at master · BabylonJS/Babylon.js · GitHub installs onGamepadConnectedObservable that is just not triggered for new cameras.
Looks more of a design flaw than a bug really.

My workaround for the time being is
newCamera.inputs.attached.gamepad.gamepad = oldCamera.inputs.attached.gamepad.gamepad
:slight_smile:

So I guess that attachControl() should take existing gamepad from some singleton, in addition to installing event handler.

adding @RaananW

good catch! you are totally right. will take care of that :slight_smile:

2 Likes