Skip to content
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

Implement directional gamepad vibration #11642

Open
eddieataberk opened this issue Jan 26, 2025 · 7 comments
Open

Implement directional gamepad vibration #11642

eddieataberk opened this issue Jan 26, 2025 · 7 comments

Comments

@eddieataberk
Copy link

Describe the project you are working on

A game uses gamepad

Describe the problem or limitation you are having in your project

Godot doesn't allow left and right side of the gamepad to vibrate independently

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Make it possible to determine the direction of vibration while calling start_joy_vibration function

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

either change the signature of start_joy_vibration or add a start_directional_joy_vibration function with following signature

start_directional_joy_vibration(device: int, left_weak_magnitude: float, left_strong_magnitude: float, right_weak_magnitude: float, right_strong_magnitude: float, duration: float = 0)

If this enhancement will not be used often, can it be worked around with a few lines of script?

no

Is there a reason why this should be core and not an add-on in the asset library?

It is about Input core

@AThousandShips
Copy link
Member

AThousandShips commented Jan 26, 2025

As far as I can see general controllers don't support this, they usually have two motors of different type, vibrating with high or low intensity

On windows the high low magnitude arguments are passed to the left and right motors (see the XINPUT documentation on this

What controllers support directional vibration (I assume Switch JoyCons can possibly be vibrated separately)

@eddieataberk
Copy link
Author

eddieataberk commented Jan 26, 2025

It is standard for XBox and Playstation controllers to have seperate body and trigger motors for left and right for a very long time. I am assuming it would be the same for switch too. Coming from Unreal it surprised me Godot doesn't have a way to trigger motors seperately.

Image

Image

@eddieataberk
Copy link
Author

On windows the high low magnitude arguments are passed to the left and right motors (see the XINPUT documentation on this

https://learn.microsoft.com/en-us/gaming/gdk/_content/gc/reference/input/xinputongameinput/structs/xinput_vibration_ex

@eddieataberk
Copy link
Author

Took apart the xbox controller to see how it behaves. It seems it behaves even stranger. weak_magnitude affects the right body motor while the strong_magnitude affects the left body motor. under no circumstance trigger motors rotates. i thought weak magnitude would rotate the trigger motors as the name suggest.

@eddieataberk
Copy link
Author

Update: It seems the XInputOnGameInput.h header for the xinput_vibration_ex is xbox only. However I found that SDL does exactly what I am trying to do in a platform agnostic manner.

@eddieataberk
Copy link
Author

Update 2: Implemented SDL. It works like a charm. I am still not sure what I am doing with SConstruct but it was relatively easy to make it work lol.

@Calinou
Copy link
Member

Calinou commented Jan 27, 2025

This will likely have to wait on that proposal to be implemented.

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

No branches or pull requests

3 participants