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

Allow tilt input on Z instead of X #12530

Merged
merged 6 commits into from
Aug 21, 2021
Merged

Allow tilt input on Z instead of X #12530

merged 6 commits into from
Aug 21, 2021

Conversation

iota97
Copy link
Contributor

@iota97 iota97 commented Dec 25, 2019

By using Z accelerometer axis it's possible to play when the phone screen is not parallel to the ground but rather perpendicular to it, making it easier to controll it from standing or sitting position.

I am totally lost about how to name such an option tho'.

Edit: Fixes #10515 and fixes #12620

@hrydgard
Copy link
Owner

Yeah, makes sense. Also not sure how to name it though :)

@i30817
Copy link

i30817 commented Dec 31, 2019

Why name it? Couldn't this be automatic? I don't understand why can't the axis for movements always be relative to the direction the screen is facing, or a default option for that at least (i suppose some games might have weird required movements that move the screen to something not facing the player).

edit: ok, if the tilt would change the facing direction (ie, not like a steering wheel) it would be functionally the same as a non-op if it was 'always updating', but there may be a solution to that with thresholds.

@iota97
Copy link
Contributor Author

iota97 commented Dec 31, 2019

Added a third option (auto-switch) that change mode if it detect a big change in orientation, it seem to work fine on my phone, also having a multi-choice seem better at explaining what the setting does.

@iota97
Copy link
Contributor Author

iota97 commented Jan 13, 2020

Fix #10515

@hrydgard
Copy link
Owner

Anything else you want to squeeze in here? I'm inclined to just go ahead and merge this, it's useful functionality.

@iota97
Copy link
Contributor Author

iota97 commented Jan 14, 2020

The button masking is not perfect: it allow you to press a button controlled by tilt with touch as well, but it can be released by tilt even if it was pressed with touch in first place.
To handle all the possibility we will need some more masking variable, but i am not sure if is really worth the extra code complexity for such a corner case.

That the only thing i think it's left in case is needed.

EDIT:
CtlrPeekBtn might be enough to do the trick, i will test later this evening.

@iota97
Copy link
Contributor Author

iota97 commented Jan 14, 2020

Now it will not reset a button that was held when the tilt enable and then disable it.

If a button get pressed when it was also enabled by tilt, tilting back will release it even if the button is still hold on touch screen.
I don't think this can be worked around easily with the current data struct (I might be very wrong on this tho'). I am not sure if is worth making thing more complex for such a case as well. Any suggestion is welcome ofc.

That's the last part that itches me, if you think is not worth going around that you may just go ahead and merge.

Copy link
Collaborator

@unknownbrackets unknownbrackets left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if we end up counting the buttons pressing/not pressing inputs, we'll end up with bugs to fight when things are released/etc. That doesn't necessarily mean we shouldn't, but it's definitely a road of complexity.

It looks like this at least doesn't release buttons that are held before and after the tilt.

I guess even combo buttons have this problem, in theory. Haven't really seen people complain about that though, so maybe it's not as much of a problem...

-[Unknown]

UI/TiltAnalogSettingsScreen.cpp Outdated Show resolved Hide resolved
@hrydgard hrydgard added the Input/Controller Input and controller issues label Jul 27, 2020
@hrydgard hrydgard added this to the v1.11.0 milestone Jul 27, 2020
@hrydgard hrydgard modified the milestones: v1.11.0, v1.12.0 Dec 13, 2020
@hrydgard hrydgard merged commit 7733d8a into hrydgard:master Aug 21, 2021
@iota97 iota97 deleted the tilt branch August 23, 2021 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Input/Controller Input and controller issues
Projects
None yet
5 participants