Discussion:
SDL_GameControllerGetAxis() question
(too old to reply)
Andreas Falkenhahn
2017-05-01 15:20:52 UTC
Permalink
With my Xbox 360 controller I get the following values from
SDL_GameControllerGetAxis() when the controller is just
idle:

LEFTX: -2263
LEFTY: 2092
RIGHTX: 4681
RIGHTY: 7703

Is that normal? I'd expect to get 0 for those axes when
I don't touch anything on the controller. With the trigger
buttons the behaviour is as expected and SDL returns 0
in case I don't touch them but somehow for the left and
right axes this isn't the case and I get these values from
above...

Tested on Windows with SDL 2.0.5.
--
Best regards,
Andreas Falkenhahn mailto:***@falkenhahn.com
Ismael Serrano
2017-05-01 15:50:37 UTC
Permalink
Hello,

That's the called dead zone for the axis and thumbs.

Since they can't be exactly at zero you must ignore the values inside that
dead zone.

More info:
http://www.falukdevelop.com/2016/11/02/sdl2-controller-implementation/

Have a good day.
Post by Andreas Falkenhahn
With my Xbox 360 controller I get the following values from
SDL_GameControllerGetAxis() when the controller is just
LEFTX: -2263
LEFTY: 2092
RIGHTX: 4681
RIGHTY: 7703
Is that normal? I'd expect to get 0 for those axes when
I don't touch anything on the controller. With the trigger
buttons the behaviour is as expected and SDL returns 0
in case I don't touch them but somehow for the left and
right axes this isn't the case and I get these values from
above...
Tested on Windows with SDL 2.0.5.
--
Best regards,
_______________________________________________
SDL mailing list
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Andreas Falkenhahn
2017-05-01 16:19:18 UTC
Permalink
Thanks!
Post by Ismael Serrano
Hello,
That's the called dead zone for the axis and thumbs.
Since they can't be exactly at zero you must ignore the values inside that dead zone.
http://www.falukdevelop.com/2016/11/02/sdl2-controller-implementation/
Have a good day.
With my Xbox 360 controller I get the following values from
SDL_GameControllerGetAxis() when the controller is just
LEFTX: -2263
LEFTY: 2092
RIGHTX: 4681
RIGHTY: 7703
Is that normal? I'd expect to get 0 for those axes when
I don't touch anything on the controller. With the trigger
buttons the behaviour is as expected and SDL returns 0
in case I don't touch them but somehow for the left and
right axes this isn't the case and I get these values from
above...
Tested on Windows with SDL 2.0.5.
--
Best regards,
_______________________________________________
SDL mailing list
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
--
Best regards,
Andreas Falkenhahn mailto:***@falkenhahn.com
Continue reading on narkive:
Loading...