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

Added (incomplete) motion controls emulation support. #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Helios-vmg
Copy link

This adds a new keyboard shortcut (unbound by default) that when pressed toggles the emulator to interpret the analog sticks as combined gyro and accelerometer inputs. Roughly speaking:

Left stick horizontal: Like rocking the controller side to side (stick right -> controller tilted right).
Left stick vertical: Like rocking the controller forward and back (stick up -> controller tilted forward [or pitched down])
Right stick horizontal: Like rotating the controller around an axis parallel to the analog sticks (i.e. changes the yaw) (stick right -> controller rotates North to East)
Right stick vertical: No function

It's difficult to control and really not practical for any action gameplay, but it's workable for puzzles, and if you don't have a controller with motion sensors it's better than nothing. I managed to use this to solve a couple shrines in BotW.

TODO:

  • A better translation algorithm? I wasn't really sure how to translate the inputs into what the Switch expects. See notes below.
  • Sensibility settings, and possibly better control curves. I've had trouble finding a sensibility that gave both precision and quick movements.
  • The toggle affects all connected controllers. I would have liked to be able to bind a button per controller, but the controller may not even have any buttons left after binding them for the normal controls.
  • Right now the toggle state is persistent and stored as a setting. It should probably be volatile.
  • The UI translations for the shortcut are missing, except for English and Spanish.

Notes:
If someone else wants to tackle the input translation, after some experimentation I figured out that the Switch's coordinate system is right-handed, with X to the right, Y forward, and Z up (relative to the controller when it's lying flat on the floor). When the controller is at rest, the accelerometer vector is the direction of gravity ((0, 0, -1) seems to work for a neutral position). The gyroscope values are angular velocities, and since the coordinate system rotates with the controller, specifying these values is usually simple. Note that in my experimentation, it seems gyroscope changes without accelerometer changes are often ignored; ideally moving any stick in any single axis should change both gyroscope and accelerometer in an integrated fashion. Finally, I'm not sure about the units. I think the accelerometer may be in g (1 = 9.8 m/s^2). The gyroscope could be in deg/s, but not sure.

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

Successfully merging this pull request may close these issues.

1 participant