-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vibration doesn't work for some controllers #14634
Comments
Works for me on Windows 10, with an Xbox 360 controller. Might be Linux only. |
The controllers are successfully connected, the control works without unnecessary movements. Vibration works on Steam, but not in Godot. |
Tested on Mageia 6 x86_64 (Linux) with the same commit and my two controllers work fine:
|
Ubuntu 17.10 x86_64 |
Hm... I try check demo project little later, maybe I just use method not right. |
Okay, only Steam Controller via SC Controller app works with vibration. Others - worked and finded by godot app, but vibration doesn't work. |
We have now entered release freeze for Godot 3.0 and want to focus only on release critical issues for that milestone. Therefore, we're moving this issue to the 3.1 milestone, though a fix may be made available for a 3.0.x maintenance release after it has been tested in the master branch during 3.1 development. If you consider that this issue is critical enough to warrant blocking the 3.0 release until fixed, please comment so that we can assess it more in-depth. |
We need more information on what exact controller models and setup do not work, as so far nobody could reproduce those issues. |
I am here to bring an exact setup for my controller. I am using MacOS Mojave 10.14.6 with a Dualshock PS4 Controller I bought at Walmart. The controller vibrates when told to by Steam (Identify Controller Feature). The model number of the controller is CUH-2CT2U. It is an official Sony controller. Using the System Information app on my Mac, I found this info (Bluetooth).
|
Not getting vibration from PS4 controllers on Windows builds. Checked and still present in 318c693. I have had this issue for as long as I have been using Godot. Reluctant to report, since it seems like there are no longer active contributors for this area of the engine. So the following line does nothing for me, but will work if I use an emulator to emulate an XBox controller.
My details are: Win10 64-bit |
Note that--on Windows--vibration relies on the XInput API which the official docs describe as "allows applications to receive input from the Xbox Controller for Windows"--i.e. at least officially, it's not a generic controller API. I notice that SDL haptic support includes XInput & DirectX Input support on Windows, so adding additional controller support via DirectX may be possible. Related issue: #30256 Related links:
|
At least for Windows, controllers need to be emulated as an XInput device. I tested with my DualShock 4 controller on Windows 10 and it didn't work, however when I used DS4Windows, which turns your DS4 into an emulated Xbox controller, it did work. DS4Windows seems to use the ViGEmBus driver for it's emulation, perhaps that could be a place to look. |
For the record, I just ran into a "Vibration not working issue". My controller was plugged via a (cheap) usb hub, and that was the issue. I soon as i connected my gamepad directly to the computer it worked. I guess the hub did not deliver enough power for the vibration motors. |
Vibration is not working for me using Xbox Series X controller, on macOS Big Sur over bluetooth. |
@brettchalupa It's up for grabs. I don't think anyone else is working on this. |
I've been doing some testing on Ubuntu, Steam Deck, and macOS today with a little test app to detect controllers and rumble them. Here are my findings so far with Godot v4.0.rc2.official [d2699dc].
I haven't booted up Windows and tested that yet, but I am assuming Xbox (aka Xinput) works there. My next steps are:
If anyone else is interested in lending a hand with testing or investigating, let me know! It'd be much appreciated. |
On Windows, you'll find only XInput to be working. All other controllers need directinput that is not implemented. Switch Pro controllers only work using Steam Input when connected via cable. Bluetooth seems to be working though. I dunno what they do to make that work (Windows only reads information spam). SDL has some info how to trigger vibrations on DualShock and DualSense as well as an example how to use the adaptive triggers. Maybe you'll find some pointers there. |
@HaSa1002 Thanks, that's some helpful guidance and direction. 👍 |
Let me know if I'm being too noisy here, but I thought I'd share some findings from the world of macOS rumble. I tested some Unity games that I know have rumble support and none of them worked on macOS. So I dug into Apple's haptics API and can confirm it rumbles DS4 and XInput controllers with this sample game they provided. So at the very baseline, we know that with Swift and Apple's SDK, you can rumble a DS4 and Xbox One controller on macOS 12.6. Then I thought, okay, let's see if SDL2 can rumble controllers on macOS. I wrote a little SDL2 CLI tester and tested some controllers. The controllers using XInput rumbled, awesome! And a controller that emulates Switch Pro Controller rumbled too, just a bit weakly. DS4/MFi and DirectInput controllers didn't rumble though, and SDL reports them as not supporting rumble. So what does this mean? Well, it should at least be possible to get XInput controllers rumbling on macOS in Godot by referencing SDL's implementation. That's my initial goal, that way XInput controllers work on macOS, Windows, and Linux. From there, outstanding questions are:
But I think XInput on modern macOS probably seems like a fine starting place for now for making this a bit better. All right, time to dig into the Godot source. 😸 |
See discussion on godotengine/godot-proposals#2829. JoyShockLibrary is in maintenance mode and may not remain maintained in the long term, but we don't want to adopt the entirety of SDL for binary size reasons (among other concerns). Copy-pasting code from relevant libraries is fine still. |
I’ve continued my research and testing to better understand what’s possible and what is and isn’t working. Here are some more findings:
In summary: rumble for XInput on MacOS and DualShock 4 on Windows are my highest priorities. Need to test Deck, iOS, and Android more. Chrome web may be possible. It’s unclear how possible DS4 on MacOS will be, needs more experimentation. I don’t have a Dual Sense controller yet, but I’d like to eventually test and support that too. A lot of what I’ve shared is just confirming the issues reported above, but it helps me to test the issues and have a couple control groups to test against like the SDL tester and a Unity game I know rumbles. I have a pretty good grasp on what’s possible and what to do next. Will try to report back in the coming days and hopefully have a PR. |
I've been digging into the Godot MacOS joypad vibration code and have some options for the path forward. Feedback and guidance would be much appreciated! Current Godot MacOS Joypad Vibration ImplementationRight now the Godot Joypad implementation on MacOS uses Apple's ForceFeedback API. See the headers and vibration code. The ForceFeedback API has been supported in MacOS since 10.2, released back in 2003. It's not clear to me what devices this rumbles, but we do know it doesn't work for modern game controllers. Godot also uses the MacOS IOKit API for interfacing with joypads. MacOS Controller Paths ForwardHere are the options I see:
My ThoughtsI am honestly not sure... HIDAPI seems like it could unlock DualShock 4 rumble on Windows but would require a lot of work. More than I am likely capable of taking on. Going with the Apple GameController framework seems approachable because of Godot's iOS joypad implementation I can reference. It's also appealing to use a system API that can be shared across Apple platforms. Next StepsI'm not an expert in this domain. I'm just a person who wants my controller to rumble and am willing to do the work to help make that happen. 😂 I may be missing an option for a path forward. Are any contributors/maintainers able to give me some guidance on how to proceed with this work or conversation? The scope of the decision seems too big for me to just make and start hacking away at the implementation without guidance/feedback. |
Godot 4 requires macOS 10.12 or later, so that's fine. |
Given I haven't gotten much feedback on my comment above, I'll plan on proceeding with the proposed option 1, Use the MacOS GameController system framework for getting MacOS vibration working. After sitting with this and learning more Godot over the past month, I think it's a good long-term solution. Once that's done, I'd like to explore vibration on iOS, Android, Chrome web, and DualShock 4 on Windows after that. Help/support with DS4 on Windows would be welcome, as it's quite a different implementation than what exists. Just to set expectations, it may be a few weeks/months before I have time to do this. But it's on my radar and important to me as I develop primarily on MacOS and want to add and test rumble in my games. |
that should be fine, provided you can keep compatibility with the existing gamepad mappings |
Sorry for such silence here on this issue. I sadly no longer have a macOS machine due to a job change and am not able to really dig into the issue of getting rumble working on modern macOS. I hope that my findings that I shared above at least help someone pick this up with a little bit of context and info. Consider this issue unassigned and free to pick up for anyone who is interested in attempting to fix it. 👍 |
#14634 #30256
On Godot v4.0.3.stable.official [5222a99] With These Specs: (Some Irrelevant personal info omitted) With This PS4 Controller Model: This was tested in Debug mode not in a build of the game. p.s Sorry if I formatted/ referenced issues etc wrongly I am new to github. |
Hi, I just noticed that vibration doesn't work for controllers in macOS a few days ago, so I tried to fix it. I would appreciate if someone interested could test it. And thanks to @brettchalupa for the initial guide on how controllers work in Godot and how this issue could be addressed. |
This implementation complies with Godot's documentation regarding start_joy_vibration. Relates to godotengine#14634 and fixes it for macOS.
Tested on MacOS with Xbox Series S gamepad, dualshock 4 and joycons, none working (as of version 4.1.3). |
@coelhucas There is already PR, I was able to test my Bluetooth XBox controller on Macos. |
For macOS, this is already fixed in the master branch~ |
After #80709, I think we can close this old issue. If anyone still experiences non-working vibration with some controllers on some platforms in 4.3 or later, please open a dedicated issue for that controller / platform combination so it can be assessed. |
The issue continues happening in v4.2.2.stable.official when running it (reproduced it in the editor, using Windows 10): -Xbox compatible gamepads rumble properly |
I am having the same issue on 4.3.stable on Windows 11. I've tried multiple Sony/Nintendo controllers and none seem to provide vibration. All of my Xbox gamepads work fine. Seems to be a DirectInput vs. XInput sort of thing. |
Bugsquad note: This issue has been confirmed several times already. No need to confirm it further.
Operating system or device, Godot version, GPU Model and driver (if graphics related): 1c0007b commit from master branch, Linux Mint Mate 18.2 x86_64
Issue description: (for example)
Input.start_joy_vibration(0, 0.5, 1, 5)
don't do anything. Tested with connected PS, XBox and Steam Constrollers.Bugsquad edit (keywords for easier searching): vibrate, gamepad, joystick
The text was updated successfully, but these errors were encountered: