Skip to content

Motion Sensor / Gyro Aiming support#644

Open
AL2009man wants to merge 25 commits intofgsfdsfgs:portfrom
AL2009man:PerfectGyroDarkZero
Open

Motion Sensor / Gyro Aiming support#644
AL2009man wants to merge 25 commits intofgsfdsfgs:portfrom
AL2009man:PerfectGyroDarkZero

Conversation

@AL2009man
Copy link
Copy Markdown

@AL2009man AL2009man commented Aug 11, 2025

One year ago, I made a request on adding Gyro Aiming support (#418), one year later: I decided to attempt to add gyro aiming support myself, with assistances.

Thus: this adds Gyro Aiming support for compatible controllers such as PlayStation and Nintendo Switch controllers! Gyro Aiming is enabled by default for Crosshair/Aiming only. Portions of this feature is powered by GamepadMotionHelper (but a fork of a fork to allow easier C compatibility layer) to handle Gyro Calibration and Gyro Space orientation (Player Space and World Space)

this new addition will add various gyro-related features that is known to be featured in some commercially released games. while not everything is feature, the necessities are in:

  • Gyro Sensitivity sliders for both Camera and Crosshair Aiming.
    • Gyro Crosshair is enabled by default
    • Gyro Speed scale are based on Natural Sensitivity Scale / Real World Sensitivity
      • for example: 1.00 is equivalent to 1:1 Controller Movement, 2.50-onwards will multiply. This only applies to [Gyro Speed]
      • 2.50 is the default gyro sens, consistent with selected games that uses RWS.
      • X/Y Output Mixer** can be used to reduce vertical or horizontal ratio for both Gyro Speed and Gyro Crosshair Speed.
        • Enabling "Gyro Advanced Settings" will let you change the Gyro Speed's X and Y Camera movements individually. (do note that "Gyro Speed X" doubles as a "Unified Gyro Speed' slider, if you disable the toggle, and then re-enable the same toggle:it'll reset your Y Axis setup in the process)
  • Gyro Orientation
    • Yaw (set by default)
    • Roll
    • Local Space
    • Player Space
    • World Space
  • Gyro Calibration
    • Gyro Calibration UI (within Gyro Settings) - pressing "Initiate Gyro Calibration..." will start the manual calibration process. this gives you enough time to place the controller on a flat surface, if it fails: you can press the same button to restart the calibration process.
    • Gyro Auto-Calibration - There are three methods:
      • While In Menus: While the Menu dialog is opened, Gyro Auto-Calibration will begin whenever the controller is already placed on the ground, calibration stops when you pick up the controller and tilt around. This is the default
      • While Stationary: Same as While In Menu, but will attempt to Auto-Calibrate at anytime when the Controller is placed on the ground (or detects very little movement) and calibrates continuous
      • Always: Will try to Auto-Calibrate whenever possible, if it can't be confident within a certain threshold (if it drops below 50% internally): it'll try to autocalibrate again.
    • Gyro Calibration button - Pressing the View Button on your Xbox controller (as an example, assume it has Gyro support!) will instantly calibrate itself.
  • Gyro Activation Modifier (Always On, Toggle, Hold)
    • While using Toggle or Hold function, this requires assigning "Gyro Activation Modifier" to any of the Input Rebinds.
  • Smoothing, Tightening, Deadzone and Invert Y/X.
image image

This PR also includes some quality-of-life changes on the Inputs side that includes:

This adds Gyro Aiming support for compatible controllers such as PlayStation and Nintendo Switch controllers! Gyro Aiming is enabled by default for Crosshair/Aiming only.

Gyro-specific features will include the following:

* Gyro Sensitivity sliders for both Camera and Crosshair (up to 30x)
  * Gyro Speed X/Y scale are based on Natural Sensitivity Scale / Real World Sensitivity
  *  1.00 is equivalent to 1:1 Controller Movement, 2.50-onwards will multiply. **This only applies to [Gyro Speed X/Y]**
* Gyro Orientation (Yaw, Roll, Local Space, Player Space, World Space)
* Gyro Calibration (Gyro Calibration UI, Auto-Calibration modes, or on-the-fly Calibration)
* Gyro Activation Modifier (Always On, Toggle, Hold)
* X/Y Output Mixer, Smoothing, Tightening, Deadzone and Invert Y/X.
* Reset Camera / Crosshair action (also works on regular joystick and keyboard/mouse inputs!)
@AL2009man AL2009man marked this pull request as draft October 2, 2025 04:25
Temporarily reverts back to previous commit and redid organization, this should address a bug where Gyro Autocalibration stopped working after first calibration

Additionally: the Gyro Processing order has been changed, it should improve overall responsiveness.
@AL2009man AL2009man marked this pull request as ready for review October 2, 2025 22:18
…ck/Select Button

improved Gyro Deltarate, now uses game engine's internal deltatime rate instead.

Also changed Gyro Calibration (Manual) binding to BACK/SELECT Button as the new default. DualShock 4 users should be able to simply calibrate the gyro on the fly without the need to rebind.
SDL_WINDOWEVENT ain't suppose to be here yet.
Upgraded the Noise Threshold of Motion Sensor, will now be based upon SDL TestController's Gyro/Accel Noise threshold system. However: this requires updating and cleaning up Gyro AutoCalibration system inorder to better support the new threshold
Moderate weak the confidence and stillness level during Gyro Autocalibration across Always and Stationary Mode. Always mode should be balanced in terms of confidence level.
…ce reset on Menu Diag while using Menu-only Gyro AutoCalib

Gyro Autocalibration's save offset wasn't saving properly while switching modes, but it should now functions as intended.

also: while `GYRO_AUTOCALIBRATION_MENU_ONLY` / `1` is set: the entire autocalibration process will now reset everytime MenuDataisdialogopen
Stationary/Menu calibration should now consistenly be timer-based, while Always mode leverage GamepadMotionHelper's confidence system better.
@AL2009man
Copy link
Copy Markdown
Author

AL2009man commented Oct 25, 2025

after a series of hardships, despite issues): I can confidently say that this PR is 99% complete!

the reason why you see a couple of more commits is due to getting Gyro Autocalibration to work properly, it took a while to get there (due to lack of a proper debug log, but recently got the message notes working properly inorder to debug and fix), but it's pretty much lock-in. (edit: well, as long as I don't stop any more bugs)

All that's left is the maintainer to review and push it. all future Gyro-related changes will have to be reside in a separate PR

…ontroller still

GamepadMoitonHelper's Confidence system has been added to Stationary system again, but this time: applies to menu-based gyro autocalibration, this should prevent accidental bad calibrations.
…own instead of 10s

Gyro Autocalibration's timer function for "While In Menu" should now behave properly.
@AL2009man AL2009man marked this pull request as ready for review December 5, 2025 20:44
to prevent anymore merge conflict, the placement order for Crosshair Swivel fix has been corrected...i hope?
to reduce bloat, and make it easier to manage: Crosshair/Camera Recenter action has been migrated to fgsfdsfgs#682
@AL2009man AL2009man force-pushed the PerfectGyroDarkZero branch from ff8338a to 9c62596 Compare January 27, 2026 22:40
after debating, I decided to combine Gyro Speed X and Y (including Gyro Crosshair) into one single "Gyro Speed".

As the general sensitivity operates more like Natural Sensitivity Scale for "Gyro Speed", it now has a "x" symbol to better indicate it's "multiplier" nature of it. Those whose coming to Steam Input's Gyro Settings or Fortnite (but they use the "1:1" setup) will be far more familiar with that setup.

 and don't worry: `pd.ini`'s `GyroSpeed` and `GyroAimSpeed` will prioritize based on the higher value

as a result: "Gyro X/Y Output Mixer" slider placement has been moved to below Gyro Crosshair Speed slider, as that becomes your main way to reduce the Horizontal and Vertical Sensitivity slider.

For those who prefer individual X and Y Camera sliders: just enable "Gyro Advanced Settings", but it will disable X/Y Output Mixer.
Reworked Natural Sensitivity Scale to use camera angles directly
will be a bit closer to SDL TestController's setup
@AL2009man AL2009man force-pushed the PerfectGyroDarkZero branch from fa06b9b to 3dd5d21 Compare February 1, 2026 03:06
fixed a bug when using Gyro Input when Mouse Aim Lock is enabled, the crosshair still moves at the same time.

Additionally: the gyro clamp was removed and move the gyro's framerate scale over to `input.c` to better match `allowmlook` 's setup.
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