Skip to content

Conversation

@Nintorch
Copy link
Contributor

@Nintorch Nintorch commented Jun 25, 2025

Closes godotengine/godot-proposals#2829
Closes godotengine/godot-proposals#8519
Closes godotengine/godot-proposals#6930
Closes godotengine/godot-proposals#3799
Fixes #78805
Potentially addresses #98008
Partially addresses godotengine/godot-proposals#12087

Supersedes #88590
Supersedes #89193

Since SDL joypad driver was merged recently ( #106218 ), this PR adds support for new SDL joypad features that weren't previously possible due to older custom joypad implementations. These features include:

  • Getting access to gamepad's sensors (accelerometer and gyroscope), including sensor calibration and simulated gravity sensor (because SDL doesn't support real gravity sensors);
  • Setting gamepad's LED light, if supported by the gamepad;
  • Getting information about controller's power and connection information;
  • Getting access to gamepad's touchpad(s);
  • DualSense adaptive triggers;
  • Xbox rumble triggers (only available on Xbox One controllers, not to be confused with DualSense adaptive triggers).
  • Getting gamepad's model type to check if it's a PS4 controller, an Xbox One controller, etc.;
  • Getting joypad type (checking if it's a gamepad, arcade stick, flight stick, etc.);
  • Getting the number of available buttons and axes on a controller;
  • Getting the names for gamepad's button and axes names, if available (these may not work exactly as expected if the gamepad is not a first-party gamepad from PlayStation, Xbox or Nintendo because SDL cannot otherwise check what the labels on the controller are);
  • Sending custom data packets to supported controllers via Input.send_joy_packet().

There are other more complex features that can be done with SDL functionality, but I decided to move them to separate PRs (see "TODO for separate PRs" section below).

There are some SDL functions that may not be necessary in Godot, so I think they need some discussion before they can be implemented (see "Features that need to be discussed whether they should be implemented or not" section below).

Roadmap and TODO

Documentation:

  • Documentation for joypad device types (SDL_JoystickType): https://learn.microsoft.com/en-us/windows/win32/xinput/xinput-and-controller-subtypes
  • Sensor documentation: https://wiki.libsdl.org/SDL3/SDL_SensorType (BTW Horizontal joycons' yaw and roll axes are swapped, needs to be reported to SDL github) Just checked again, they're not
  • How accelerometer's gravity is calculated: https://developer.android.com/reference/android/hardware/SensorEvent#values
  • Document how to get raw accelerometer values (Input.get_joy_accelerometer() + Input.get_joy_gravity())
  • Input.get_joy_model_axis/button_name() may not work exactly as expected if the gamepad is not a first-party gamepad from PlayStation, Xbox or Nintendo because SDL cannot otherwise check what the labels on the controller are
  • Motion sensors examples with calibration
  • SDL doesn't support motion sensors (and LED light) on platforms other than the desktop ones (they don't work well on Android and iOS and they don't work at all on Web since no hidapi support on Web)
  • Fix "TODO: description"
TODO when Godot gets SDL input support for other platforms
TODO for separate PRs
Features that need to be discussed whether they should be implemented or not

TODO 2:

  • Test project on macOS doesn't recognize the joycon controllers, even though InputMap does recognize them
  • Mention that people will need some sort of driver for Xbox trigger rumble to work, there's an SDL github issue where that's described (or maybe they won't need it? [Windows] Trigger rumble libsdl-org/SDL#12071 )
  • Mention that it's recommended to disable the motion sensors if they're no longer needed because it can theoretically drain the controller's battery more quickly
  • Input.get_joy_accelerometer() should probably return the raw accelerometer values, while there should be another method Input.get_joy_accelerometer_motion() that's equivalent to the current functionality, I think?
  • Don't rely on SDL's enums directly, we may need a function to convert SDL's enums to Godot enums (for example, so we can have PLAYSTATION_GENERIC joypad model or Steam Deck model)
  • Fix rumble triggers

TODO, splitting:

Here's a small project to test new joypad features:
JoypadTest.zip

@Calinou
Copy link
Member

Calinou commented Jun 25, 2025

Supersedes #88590

Note that #88590 also implements DualSense adaptive triggers, which isn't on the roadmap of this PR currently. This could be done in a separate PR in any case, but I thought I'd mention it as SDL supports adaptive triggers.

@Nintorch
Copy link
Contributor Author

Supersedes #88590

Note that #88590 also implements DualSense adaptive triggers, which isn't on the roadmap of this PR currently. This could be done in a separate PR in any case, but I thought I'd mention it as SDL supports adaptive triggers.

Good catch, thank you, I'll add that to the roadmap!

@Meorge
Copy link
Contributor

Meorge commented Jun 25, 2025

I'm especially excited to see Joy-Con support listed here. I think those are really fun little controllers, so much so that I started making my own C++ library for interfacing with them and a Godot GDExtension based off of that - however, obviously being a GDExtension, it doesn't mesh very well with Godot's built-in APIs. Having the support be more built-in to the engine would be awesome!

I'm not sure how much overlap there is between SDL's Joy-Con support and what my library does, but if a lot of the Joy-Con-specific features don't have SDL APIs, I may be able to help on that front 😄

@Nintorch Nintorch force-pushed the joypad-new-sdl-features branch 2 times, most recently from 9940d41 to 9e6d7d8 Compare June 26, 2025 13:25
@Nintorch
Copy link
Contributor Author

I made a list of features that need discussion before implementing, so if you think any of the listed features are important to have built into the engine, you can let me know!

@Nintorch Nintorch changed the title Add support for new SDL joypad features (gyroscope, accelerometer, LED, etc.) (WIP) Introduce new joypad features provided by SDL3 (WIP) Jun 26, 2025
@Nintorch Nintorch force-pushed the joypad-new-sdl-features branch 2 times, most recently from b39eef9 to e70bbb5 Compare June 27, 2025 18:47
@mubinulhaque
Copy link

mubinulhaque commented Jun 28, 2025

Feature request for a separate PR: querying for separate keyboards and mice (SDL_GetKeyboards and SDL_GetMice respectively)

@Calinou
Copy link
Member

Calinou commented Jun 28, 2025

Feature request for a separate PR: querying for separate keyboards and mice (SDL_GetKeyboards and SDL_GetMice respectively)

Multi-keyboard/mouse support seems subpar in SDL 3 from what I've heard, so it may not be worth the effort. This is based on what I've seen in the Perfect Dark PC port Discord (people have tried implementing it there, but quickly regretted it).

@LunaCapra
Copy link
Contributor

Will the gamepad type for GameCube controllers be included? It seems to be the only one not added from SDL_GamepadType.

@Meorge
Copy link
Contributor

Meorge commented Jun 28, 2025

I'm still very excited for Joy-Con support and would love to contribute where I can, but thinking about it more, I think specialized support for its features would fit better as a separate PR (if not some kind of plugin/addon). 😅

Maintainers should have more of a say in this of course, but I could see it being helpful to split this up into multiple smaller PRs so that each individual one is easier to test and verify.

That all being said, for this PR (whether it ends up being split later or not) I can certainly test its functionality on macOS. Let me know if/when you'd like me to give that a shot! 😄

@Nintorch
Copy link
Contributor Author

Will the gamepad type for GameCube controllers be included? It seems to be the only one not added from SDL_GamepadType.

Godot is currently using the latest stable release of SDL (3.2.16), which doesn't support GameCube controllers :( https://github.com/libsdl-org/SDL/blob/c9a6709bd21750f1ad9597be21abace78c6378c9/include/SDL3/SDL_gamepad.h

@LunaCapra
Copy link
Contributor

Will the gamepad type for GameCube controllers be included? It seems to be the only one not added from SDL_GamepadType.

Godot is currently using the latest stable release of SDL (3.2.16), which doesn't support GameCube controllers :( https://github.com/libsdl-org/SDL/blob/c9a6709bd21750f1ad9597be21abace78c6378c9/include/SDL3/SDL_gamepad.h

That's a shame. Maybe in the future then!

@Nintorch Nintorch force-pushed the joypad-new-sdl-features branch from e70bbb5 to f891f14 Compare July 2, 2025 18:17
@Meorge
Copy link
Contributor

Meorge commented Jul 2, 2025

I know this is still marked as a draft, so these may be things you're aware of and are planning on fixing, but just in case: I got excited and decided to pull it to test on macOS, and ran into some compilation errors.

In joypad_sdl.cpp, a few switch statements don't have default cases or otherwise handle all of the possible values:

drivers/sdl/joypad_sdl.cpp:335:10: error: enumeration values 'INVALID', 'SDL_MAX', and 'MAX' not handled in switch [-Werror,-Wswitch]
  335 |         switch (p_axis) {
      |                 ^~~~~~
drivers/sdl/joypad_sdl.cpp:335:10: note: add missing switch cases
  335 |         switch (p_axis) {
      |                 ^
  336 |                 case JoyAxis::LEFT_X:
drivers/sdl/joypad_sdl.cpp:451:10: error: enumeration values 'INVALID', 'SDL_MAX', and 'MAX' not handled in switch [-Werror,-Wswitch]
  451 |         switch (p_button) {
      |                 ^~~~~~~~
drivers/sdl/joypad_sdl.cpp:451:10: note: add missing switch cases
  451 |         switch (p_button) {
      |                 ^
  452 |                 case JoyButton::A:
2 errors generated.

If I add default cases to those switch statements, I get errors about the parameters in ScePadTriggerEffectParam not all being initialized:

[ 74%] In file included from core/input/.scu/scu_core_input.gen.cpp:1:
./core/input/input.cpp:1224:2: error: missing field 'padding' initializer [-Werror,-Wmissing-field-initializers]
 1224 |         SETUP_TRIGGER_EFFECT(SCE_PAD_TRIGGER_EFFECT_MODE_OFF);
      |         ^
./core/input/input.cpp:1213:40: note: expanded from macro 'SETUP_TRIGGER_EFFECT'
 1213 |         ScePadTriggerEffectParam effect = { 0 };                                                                                                \
      |                                               ^
[ 74%] ./core/input/input.cpp:1236:2: error: missing field 'padding' initializer [-Werror,-Wmissing-field-initializers]
 1236 |         SETUP_TRIGGER_EFFECT(SCE_PAD_TRIGGER_EFFECT_MODE_FEEDBACK);
      |         ^
./core/input/input.cpp:1213:40: note: expanded from macro 'SETUP_TRIGGER_EFFECT'
 1213 |         ScePadTriggerEffectParam effect = { 0 };                                                                                                \
[ 74%]                                               ^
./core/input/input.cpp:1257:2: error: missing field 'padding' initializer [-Werror,-Wmissing-field-initializers]
 1257 |         SETUP_TRIGGER_EFFECT(SCE_PAD_TRIGGER_EFFECT_MODE_WEAPON);
      |         ^
./core/input/input.cpp:1213:40: note: expanded from macro 'SETUP_TRIGGER_EFFECT'
 1213 |         ScePadTriggerEffectParam effect = { 0 };                                                                                                \
      |                                               ^
[ 74%] ./core/input/input.cpp:1279:2: error: missing field 'padding' initializer [-Werror,-Wmissing-field-initializers]
 1279 |         SETUP_TRIGGER_EFFECT(SCE_PAD_TRIGGER_EFFECT_MODE_VIBRATION);
      |         ^
./core/input/input.cpp:1213:40: note: expanded from macro 'SETUP_TRIGGER_EFFECT'
 1213 |         ScePadTriggerEffectParam effect = { 0 };                                                                   [ 74%]                        \
      |                                               ^
[ 74%] ./core/input/input.cpp:1291:2: error: missing field 'padding' initializer [-Werror,-Wmissing-field-initializers]
 1291 |         SETUP_TRIGGER_EFFECT(SCE_PAD_TRIGGER_EFFECT_MODE_MULTIPLE_POSITION_FEEDBACK);
      |         ^
[ 74%]  note: expanded from macro 'SETUP_TRIGGER_EFFECT'
 1213 |         ScePadTriggerEffectParam effect = { 0 };                                                                                                \
      |                                               ^
./core/input/input.cpp:1320:2: error: missing field 'padding' initializer [-Werror,-Wmissing-field-initializers]
[ 74%] E_SLOPE_FEEDBACK);GGER_EFFECT(SCE_PAD_TRIGGER_EFFECT_MOD
      |         ^
./core/input/input.cpp:1213:40: note: expanded from macro 'SETUP_TRIGGER_EFFECT'
 1213 |         ScePadTriggerEffectParam effect = { 0 };                                                                                                \
      |                                               ^
[ 74%] ./core/input/input.cpp:1337:2: error: missing field 'padding' initializer [-Werror,-Wmissing-field-initializers]
 1337 |         SETUP_TRIGGER_EFFECT(SCE_PAD_TRIGGER_EFFECT_MODE_MULTIPLE_POSITION_VIBRATION);
      |         ^
./core/input/input.cpp:1213:40: note: expanded from macro 'SETUP_TRIGGER_EFFECT'
 1213 |         ScePadTriggerEffectParam effect = { 0 };                                                                                                \
      |                                               ^
[ 77%] 7 errors generated.

@Nintorch Nintorch force-pushed the joypad-new-sdl-features branch from f891f14 to 3a143d4 Compare July 2, 2025 18:51
@Nintorch
Copy link
Contributor Author

Nintorch commented Jul 2, 2025

I haven't tried to compile on macOS yet, but I think I fixed these 2 errors, I hope it should now compile!

@Meorge
Copy link
Contributor

Meorge commented Jul 2, 2025

Thanks! It compiles now, but unfortunately I get a segmentation fault immediately upon starting Godot... I may be able to look further into that soon


LLDB is giving this output for the location of the segfault:

Godot Engine v4.5.beta.custom_build.3a143d442 (2025-07-02 18:50:15 UTC) - https://godotengine.org
Process 33797 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=2, address=0x16f5ffff8)
    frame #0: 0x000000010307d4e0 godot.macos.editor.dev.arm64`dlmalloc(bytes=80) at SDL_malloc.c:4615:52
   4612     if (bytes <= MAX_SMALL_REQUEST) {
   4613       bindex_t idx;
   4614       binmap_t smallbits;
-> 4615       nb = (bytes < MIN_REQUEST)? MIN_CHUNK_SIZE : pad_request(bytes);
   4616       idx = small_index(nb);
   4617       smallbits = gm->smallmap >> idx;
   4618
Target 0: (godot.macos.editor.dev.arm64) stopped.

The backtrace seems to give an infinite loop?

(lldb) bt
  * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=2, address=0x16f5ffff8)
  * frame #0: 0x000000010307d4e0 godot.macos.editor.dev.arm64`dlmalloc(bytes=80) at SDL_malloc.c:4615:52
    frame #1: 0x0000000103081e94 godot.macos.editor.dev.arm64`dlcalloc(n_elements=1, elem_size=80) at SDL_malloc.c:4837:9
    frame #2: 0x0000000103084554 godot.macos.editor.dev.arm64`SDL_calloc(nmemb=1, size=80) at SDL_malloc.c:6471:11
    frame #3: 0x00000001030a14e0 godot.macos.editor.dev.arm64`SDL_CreateMutex at SDL_sysmutex.c:34:26
    frame #4: 0x00000001030a1894 godot.macos.editor.dev.arm64`SDL_CreateSemaphore(initial_value=0) at SDL_syssem.c:75:23
    frame #5: 0x0000000103090bdc godot.macos.editor.dev.arm64`SDL_CreateCondition at SDL_syscond.c:58:21
    frame #6: 0x00000001030a18a0 godot.macos.editor.dev.arm64`SDL_CreateSemaphore(initial_value=0) at SDL_syssem.c:76:26
    frame #7: 0x0000000103090bdc godot.macos.editor.dev.arm64`SDL_CreateCondition at SDL_syscond.c:58:21
    frame #8: 0x00000001030a18a0 godot.macos.editor.dev.arm64`SDL_CreateSemaphore(initial_value=0) at SDL_syssem.c:76:26
    frame #9: 0x0000000103090bdc godot.macos.editor.dev.arm64`SDL_CreateCondition at SDL_syscond.c:58:21
    ...
    frame #1322: 0x00000001030a18a0 godot.macos.editor.dev.arm64`SDL_CreateSemaphore(initial_value=0) at SDL_syssem.c:76:26
    frame #1323: 0x0000000103090bdc godot.macos.editor.dev.arm64`SDL_CreateCondition at SDL_syscond.c:58:21
    frame #1324: 0x00000001030a18a0 godot.macos.editor.dev.arm64`SDL_CreateSemaphore(initial_value=0) at SDL_syssem.c:76:26
    frame #1325: 0x0000000103090bdc godot.macos.editor.dev.arm64`SDL_CreateCondition at SDL_syscond.c:58:21
    frame #1326: 0x00000001030a18a0 godot.macos.editor.dev.arm64`SDL_CreateSemaphore(initial_value=0) at SDL_syssem.c:76:26
    frame #1327: 0x0000000103090bdc godot.macos.editor.dev.arm64`SDL_CreateCondition at SDL_syscond.c:58:21
    ...

@Nintorch
Copy link
Contributor Author

Nintorch commented Jul 3, 2025

This PR should likely fix your issue: #107963
It happened to you because I haven't rebased this PR yet, I will do that once all features are ready!

EDIT: Decided to rebase now!

@Nintorch Nintorch force-pushed the joypad-new-sdl-features branch 3 times, most recently from 0e453aa to 898c22f Compare July 3, 2025 08:10
@Meorge
Copy link
Contributor

Meorge commented Jul 3, 2025

Thanks for the rebase! With that, the editor is now building, and I'm able to run the demo project.

It looks like the instance of JoypadSDL being used by the game process doesn't receive the joystick/gamepad-added events, which causes the joypads to be registered as not attached, and thus the special methods to not work. Here's my console output with some print_line statements I added to track the state:

> godot --editor --path "/Users/malcolmanderson/Downloads/JoypadTest"
Godot Engine v4.5.beta.custom_build.898c22fd8 (2025-07-03 08:10:03 UTC) - https://godotengine.org
construct joypadsdl (FOR EDITOR)
Metal 3.2 - Forward+ - Using Device #0: Apple - Apple M4 Pro (Apple9)

joystick added event
get_sdl_joystick: p_pad_idx = 0, max is 16, attached = true
Event for joypad 0: 1619 (SDL_EVENT_GAMEPAD_ADDED)
Event for joypad 0: 1543 (SDL_EVENT_JOYSTICK_BATTERY_UPDATED)
[0]
DualSense Wireless Controller 050057564c050000e60c00001be36d04

(GAME STARTED)
Godot Engine v4.5.beta.custom_build.898c22fd8 (2025-07-03 08:10:03 UTC) - https://godotengine.org
construct joypadsdl
Metal 3.2 - Forward+ - Using Device #0: Apple - Apple M4 Pro (Apple9)

get_sdl_joystick: p_pad_idx = 0, max is 16, attached = false
ERROR: JoypadSDL::get_joypad_features: joy == nullptr
   at: get_joypad_features (drivers/sdl/joypad_sdl.cpp:584)
   GDScript backtrace (most recent call first):
       [0] _ready (res://test_2.gd:4)

Note that after GAME STARTED, a new JoypadSDL is constructed (print_line() in JoypadSDL::JoypadSDL() is run), but the SDL_EVENT_GAMEPAD_ADDED event is not caught by it, so it's not able to update its copy of the joypads array.

That's my hypothesis for what's going on at the moment, at least. I know you may still be working on putting together the core functionality for the PR, but please let me know if there's anything else I can test or results I can provide to help with the macOS support!

@Nintorch
Copy link
Contributor Author

I'm not a Godot contributor, but looking at the patch it looks great, except SDL_error.c where the logging of errors is uncommented, and it says right over it that many errors are recoverable and would never be seen in the public api, maybe logging them in the release of godot might not be a good idea.

True, but these errors are only printed if the engine was ran with --verbose flag (see joypad_sdl.cpp, I made a custom logging function for SDL), so normally these errors won't be shown, but it would be helpful in case an SDL-related (or joystick input related) issue is reported so the users won't have to compile the engine with this fix themselves to see the SDL errors :)

@Nintorch
Copy link
Contributor Author

Nintorch commented Aug 25, 2025

Note for myself (or anyone else who's willing to test it, thanks :) ): check if #78805 is resolved by this PR or in newer 4.5 betas

@Meorge
Copy link
Contributor

Meorge commented Aug 25, 2025

Testing on macOS Sequoia 15.6.1 and a Joy-Con (R), with no Joy-Con (L) connected:

  • ZR is mapped to Joypad Button 18 (Xbox Paddle 3)
  • R is mapped to Joypad Button 16 (Xbox Paddle 1)
  • All other buttons seem to have expected mappings

For a Joy-Con (L) connected and no Joy-Con (R) connected:

  • The Minus button is mapped to Joypad Button 6 (Start, Xbox Menu, Nintendo +)
  • ZL is mapped to Joypad Button 19 (Xbox Paddle 4)
  • L is mapped to Joypad Button 17 (Xbox Paddle 2)
  • Capture is mapped to Joypad Button 5 (Guide, Sony PS, Xbox Home)
  • All other buttons seem to have expected mappings

When both Joy-Con are connected:

  • Joy-Con (L)'s SL is mapped to Joypad Button 17 (Xbox Paddle 2)
  • Joy-Con (L)'s SR is mapped to Joypad Button 19 (Xbox Paddle 4)
  • Joy-Con (R)'s SL is mapped to Joypad Button 18 (Xbox Paddle 3)
  • Joy-Con (R)'s SR is mapped to Joypad Button 16 (Xbox Paddle 1)
  • All other buttons seem to have expected mappings

TL;DR: every Joy-Con button is recognized 🙂


However, in testing this, I did find that it seems to struggle with Joy-Con controllers. The test project doesn't indicate that a controller is connected ("Gamepad connected" is unchecked, "Gamepad name" is empty, etc) although the Input Map menu does register inputs from them.

Additionally, if I connect the Joy-Cons to my computer while Godot is running, I often get an error like

ERROR: Error opening gamepad at index 3: Couldn't find mapping for device (3)
   at: process_events (drivers/sdl/joypad_sdl.cpp:144)

@Nintorch
Copy link
Contributor Author

Thank you for testing, Meorge!

However, in testing this, I did find that it seems to struggle with Joy-Con controllers. The test project doesn't indicate that a controller is connected ("Gamepad connected" is unchecked, "Gamepad name" is empty, etc) although the Input Map menu does register inputs from them

Oh, that's interesting, I will have to look into it.

Additionally, if I connect the Joy-Cons to my computer while Godot is running, I often get an error like

I also get an error like this when I connect both joycon controllers on Windows, but after that they work just fine, the test project recognizes them too.

@Tio-Henry
Copy link

In Godot 4.5, is it still not possible to use Dualsense features?

@Nintorch
Copy link
Contributor Author

In Godot 4.5, is it still not possible to use Dualsense features?

Dualsense features are implemented in this PR, so at the moment, no :(

@Tio-Henry
Copy link

Is there any way I can access a build with this PR?

@Nintorch
Copy link
Contributor Author

@Tio-Henry
Copy link

Oh, thank you so much, and thank you so much for your work in bringing the DualSense features to Godot, with this, it will be possible to work on various experiences for players.

@Nintorch
Copy link
Contributor Author

You're welcome, and thank you for your kind words! ❤️ :)

@Nintorch
Copy link
Contributor Author

Oh, thank you so much, and thank you so much for your work in bringing the DualSense features to Godot, with this, it will be possible to work on various experiences for players.

Also, may I ask if the DualSense's Adaptive Triggers work correctly with this PR? I wish I could test it myself, but I don't have a DualSense controller :(

@LoFiKari
Copy link

Oh, thank you so much, and thank you so much for your work in bringing the DualSense features to Godot, with this, it will be possible to work on various experiences for players.

Also, may I ask if the DualSense's Adaptive Triggers work correctly with this PR? I wish I could test it myself, but I don't have a DualSense controller :(

I can do that for you!

@LoFiKari
Copy link

Is there a built version of the Project?

@Nintorch
Copy link
Contributor Author

Is there a built version of the Project?

Yes, pull requests (or Godot builds with the pull requests applied) can be tested by following the steps in this link: https://docs.godotengine.org/en/4.4/contributing/workflow/testing_pull_requests.html

@LoFiKari
Copy link

Is there a built version of the Project?

Yes, pull requests (or Godot builds with the pull requests applied) can be tested by following the steps in this link: https://docs.godotengine.org/en/4.4/contributing/workflow/testing_pull_requests.html

Is there a non-mono Linux editor?

@LoFiKari
Copy link

I can confirm, the triggers do work!

@LoFiKari
Copy link

LoFiKari commented Sep 23, 2025

Rumble triggers don't though

(Edit: I'm stupid, this is an Xbox feature lol, haven't tested on Xbox)

@LoFiKari
Copy link

One issue with the build: the Camera3Ds don't work from my testing

@Nintorch
Copy link
Contributor Author

I can confirm, the triggers do work!

That's good to hear! Thank you for testing! :)

@Nintorch
Copy link
Contributor Author

One issue with the build: the Camera3Ds don't work from my testing

That's strange, I haven't touched anything 3D related in this PR.

@LoFiKari
Copy link

LoFiKari commented Sep 23, 2025

One issue with the build: the Camera3Ds don't work from my testing

That's strange, I haven't touched anything 3D related in this PR.

it could be a bug transitioning my project from godot 4.4 to 4.5, ill do some more testing

(edit: its a me issue lol, ill figure it out)

@Meorge
Copy link
Contributor

Meorge commented Sep 24, 2025

Testing on macOS with a DualSense controller plugged in via USB, the trigger haptics work for me! 🥳

The parameters the test project currently uses make it a bit hard to feel, but when I turn the strength up more I can definitely feel the difference in how the triggers respond.

It shouldn't block the completion/merging of this PR, but I think it could be good to include a bit more detail in the documentation about how the haptic trigger functions work, perhaps with a code example or two. (I'd love for the docs to have something like this for haptics in general, actually, but again this is getting out of scope for this PR 😅 )

@graywes
Copy link

graywes commented Oct 11, 2025

ive tested xbox controllers. the rumble trigger button doesnt work. ive used a program to test my rumble triggers and they are functional. ive tested over usb and wireless adapter.

controller: xbox one controller (original, no bluetooth)

program used: https://github.com/araghon007/X1nput
both godot and this program are under mit license so i think you are free to take "inspiration" form it as much as you like. he's using hid requests to start the rumble effect. perhaps you could attempt detection of an xbox controller then allow transmission of hid requests for rumble

@Nintorch
Copy link
Contributor Author

Now that I think about it, I think I can separate this big PR into several smaller PRs so it can be reviewed and merged more easily.

@AL2009man
Copy link

AL2009man commented Oct 20, 2025

ive tested xbox controllers. the rumble trigger button doesnt work. ive used a program to test my rumble triggers and they are functional. ive tested over usb and wireless adapter.

controller: xbox one controller (original, no bluetooth)

program used: https://github.com/araghon007/X1nput both godot and this program are under mit license so i think you are free to take "inspiration" form it as much as you like. he's using hid requests to start the rumble effect. perhaps you could attempt detection of an xbox controller then allow transmission of hid requests for rumble

if i recall from testing on a separate project a couple of months ago: you'd need to enable one of the hints

  • SDL_HINT_JOYSTICK_RAWINPUT and SDL_HINT_JOYSTICK_RAWINPUT_CORRELATE_XINPUT
  • SDL_HINT_JOYSTICK_WGI
  • SDL_HINT_JOYSTICK_GAMEINPUT (SDL maintainers strongly recommends this)
  • ask users to download Steam's Xbox Extended Feature driver.

the RawInput method is your best bet, but it's currently broken due to a Windows Update regression (libsdl-org/SDL#13047 (comment)). Which means: the best possible route to take is to enable GameInput (but requires either slapping in a GameInput.h or built using Xbox GDK) or enabling WGI.

not exactly ideal for the Trigger Rumbles situation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet