But I’m not really finding much other than these two pages
I want to have my character and it’s ArcRotateCamera be controlled by a gamepad class. I can set this up using my own event handlers and what not, but it seems like there is a way to do this through babylon.js - but I’m not sure how.
If I don’t do this in this way, and instead attach the gamepad input directly to the camera via camera.inputs.addGamepad() then the left stick will control the zoom radius of the ArcRotateCamera, which I don’t want.
Works for me - until I switch the camera. After that, gamepad doesn’t work with ArcRotateCamera any longer, no matter what.
I’m switching between 1st and 3rd person camera, Universal/ArcRotate, like scene.activeCamera = camera, camera.attachControl(). Everything works fine, except the gamepad input of ArcRotateCamera never takes.
Seems that one special case it works is when gamepad is attached while ArcRotateCamera is active camera.
Looks like bug in attachControl(). Or, is there some additional bookkeeping needed?
I think I noticed that as well a while back, but I haven’t been using the controller that I built lately. I may have ended up just keeping a separate camera on hand for each control type in use.
It’s a bug alright.
I’ve compared attachControl() methods of FreeCameraGamepadInput and ArcRotateCameraGamepadInput, and this is this is missing for arc rotate camera:
// if no xbox controller was found, but there are gamepad controllers, take the first one
if (!this.gamepad && manager.gamepads.length) {
this.gamepad = manager.gamepads[0];
}