Closed LordSk closed 5 years ago
From SDL wiki:
On most modern joysticks the X axis is usually represented by axis 0 and the Y axis by axis 1. The value returned by SDL_JoystickGetAxis() is a signed integer (-32768 to 32767) representing the current position of the axis. It may be necessary to impose certain tolerances on these values to account for jitter.
Don't have a joystick so can't test it myself. Would be good if someone who's able to test it could work on it.
Don't think that you have to deactivate a device(mouse/joystick). What's the benefit? You don't use them both at the same time right?
Unfortunately can't test it myself either. :(
So apparently, the issue right now is that the joystick is buggy because of the lack of tolerance for jitter, just like in that SDL wiki quote. To me, the proper thing to do would be to fix the joystick by adding this tolerance (or, second choice, disable it until it is fixed, since simply having one plugged in breaks Teeworlds).
Would be interesting to know how @tsoding did not run into this issue. Maybe he has a perfect controller :)
Side note: it seems like there is no good setup that lets you play Teeworlds on an xbox 360 controller, according to @TerminalMan
Don't think that you have to deactivate a device(mouse/joystick). What's the benefit? You don't use them both at the same time right?
Two different modes, for example:
Joystick
Mouse
Using one or the other switches mode. This pattern is used a lot for pc games supporting joysticks (e.g. Dark Souls). That's what I meant by one or the other should be active at any time. But the real issue is my controller moving my mouse cursor while I try to move my mouse. Which can be fixed by adding a tolerance, and/or by separating the two code paths.
Originally posted by @EbrahimBGA in https://github.com/teeworlds/teeworlds/pull/2047#issuecomment-471075948
the cursor moving up... Playstation Dualshock 4 - DS4Windows -Win10x64
I have Logitech Rumble F510. I guess it's a pretty good controller. ¯_(ツ)_/¯
The easiest fix without completely disabling the feature would be adding the tolerance. I could do that, but only on April 16th 2019.
P.S. @Dune-jr please use @rexim to summon me to a discussion. @tsoding doesn't work, because it's an organization and I probably haven't configuration notifications correctly or something.
Maybe add a tolerance setting for the jitter, that you can adjust or lets you detect automatically.
Fixed.
I started teeworlds with my xbox controller plugged in and the mouse cursor was moving on its own. SDL_JoystickGetAxis seems to always return a value even when not touching the controller (I guess controller sticks are not perfect).
So there are several issues here:
Relevant code:
engine/client/input.cpp