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

Add optional device number to Input polling methods #10775

Closed
iiMidknightii opened this issue Sep 18, 2024 · 3 comments
Closed

Add optional device number to Input polling methods #10775

iiMidknightii opened this issue Sep 18, 2024 · 3 comments

Comments

@iiMidknightii
Copy link

Describe the project you are working on

A multiplayer game where I need to get the input vector on analog sticks from multiple controllers.

Describe the problem or limitation you are having in your project

I need to poll analog stick axes, button states, etc. from _process to allow players to directly control nodes' rotations and positions. Right now, there is Input.get_joy_axis which does support device filtering, but that doesn't have deadzones or a way to use mapped actions.

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

Maybe all the Input methods that poll action vectors, axes, or press states could have an optional device: int = 0 added to their API.

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

var camera_vec := Input.get_vector("camera_look_left", "camera_look_right", "camera_look_down", "camera_look_up", -1.0, device)

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

I'm not sure. I guess you could go through the convoluted process of looking through the entire InputMap, find your action, and use the events to poll. You'd also have to do all the other under-the-hood stuff like deadzone correction, etc.

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

I don't know if Input could be modified this way in an add-on.

@Calinou
Copy link
Member

Calinou commented Sep 18, 2024

I feel a more generic solution like #4295 or #10070 would make more sense, as it would also work for is_action_pressed(), is_action_just_pressed() and the like.

@iiMidknightii
Copy link
Author

iiMidknightii commented Sep 19, 2024 via email

@Calinou
Copy link
Member

Calinou commented Sep 19, 2024

Thanks for the proposal! Consolidating in #4295 and #10070.

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