Gamepad Deadzone

Hey everyone,

I’ve gotten gamepads mostly setup, but I’m having issues with changing the sensitivity and deadzones.

I changed the sensitivity by changing the camera.gamepadAngularSensibility. When I set it to very high (low sensitivity), the deadzones seem to be massive. But when I set this to be very low (high sensitivity), the deadzone is brutal - the joystick sitting still will still fly around the screen.

I have found a couple of posts on this forum from a couple years ago that “solve” the deadzone problem, but after trying them, I can’t get their solutions to work as they don’t effect the camera rotation.

Changing the values in the function:
gamepad.onrightstickchanged((values) => {
values.x = 0;
values.y = 0;
});
Has no effect, so unless there’s another way I can manually manipulate the camera rotation from the joystick input values, I’m not sure how I can add deadzones.

Here’s a playground:
https://playground.babylonjs.com/#TF57ZU

Press up/down on the DPad to change the sensitivity. It will console.log the new values.
Also, in the onrightstickchanged function I try setting the values to 0 just to test stopping the joystick rotation entirely, but with no success.

I’m mostly wanting to know the best practice of changing/overriding the camera rotation before the joystick makes it’s changes.

Adding @PolygonalSun

1 Like