I am experiencing some strange behaviors of the SDL2's Haptics methods. I have tested this under Linux 64bit with libsdl2-dev and libsdl2-2.0-0 (both in version v2.0.10) and Windows 10 64bit (latest SDL binary build). As controllers I used the 8Bitdo SF30 Pro Gamepad and a Nintendo Switch Pro Controller - both connected via USB.
- The Nintendo Switch Pro Controller is not marked as haptic as all.
- Only when started in PlayStation or XBox Mode, the 8Bitdo controller is marked as haptic - but both
SDL_HapticRumblePlay
andSDL_HapticRunEffect
are driving the rumble motor at a quite low frequency (I assume 2-5 Hz) with a resulting small magnitude. Any changes in the effect struct (such as wave-type, magnitute, directions, period, and so on..) do not show any improvements. It also seems that on eachSDL_HapticRunEffect
call, the vibrations vary a bit. TheSDL_HapticsSetGain
method does not seem to have any effect either.
Do you have any suggestions on these behaviors?
- Why does the Nintendo Pro Controller not be recognized as a haptic device?
- What to do with the strange rumble behavior of the 8Bitdo controller? The rumble feature of the controller semms to be intact though (as it vibrites on some Windows games).
Although not exactly the answer you might be looking for if you must use the SDL2 haptic methods for any reason, but this comment on a similar issue with haptics in SDL2 states the following:
So the answer to both of your questions may be that SDL2 haptics is deprecated for gamepads, especially newer ones like the Nintendo Pro Controller, and thus it cannot be guaranteed to work properly (or to work at all).
However, if you simply want to get your gamepad to rumble (which is why I stumbled across this question), using
SDL_GameControllerRumble()
should do the job. It worked for me with a Nintendo Pro Controller.Have a look at the SDL_GameControllerRumble - SDL Wiki for more info on how to use it.
Required version to use this function is SDL 2.0.9.