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

[Feature/Bug] IMU data is not normalized #262

Open
pastaq opened this issue Jan 22, 2025 · 2 comments
Open

[Feature/Bug] IMU data is not normalized #262

pastaq opened this issue Jan 22, 2025 · 2 comments
Labels
bug Something isn't working enhancement New feature or request
Milestone

Comments

@pastaq
Copy link
Contributor

pastaq commented Jan 22, 2025

Currently, all axis data is normalized either signed (-1.0 to 1.0) or unsigned (0.0 - 1.0) except for IMU data, which has custom scales applied in source/target devices to make them feel somewhat close. Instead of doing this, we should refactor all IMU implementations to normalize/denormalize the values so that any source device feels consistent on any target device.

@pastaq pastaq added bug Something isn't working enhancement New feature or request labels Jan 22, 2025
@pastaq pastaq added this to the v1.0.0 milestone Jan 22, 2025
@RangerMauve
Copy link

This normalization is useful for enabling features like a gyro mouse or a gyro joystick.

A big part of the translation from 3D orientation to 2D vector would be choosing the plane along which you'd project your values. e.g. how 3DS aiming worked in Ocarina of Time or the Google Daydream controller.

The mechanic I see a lot is having a "reset orientation" trigger which sets your current position as "forward". Is there a way to specify an action to toggle the gyro mapping that could work for this and a place to store the "forward" vector that persists between translations?

This is where the translation would be done.

We should detect a Target of Capability::Mouse and have a new method called translate_gyro_to_mouse.

Prior art:

@RangerMauve
Copy link

Quote from @NeroReflex while discussing in Discord:

There are like.... 6 algorithms generally used in-games and none of them works really good for every game type sadly
You will need to have multiple translations available. The trivial one of discarding z is not that much good
Valve started with one well anough and is adding more because only one simply cannot make everybody happy
If you do your searches from the perspective of a game dev you will find multiple results doing gyro-> controls with different suggested algorithms for each type of game
For example a popular thing they do (I absolutely dislike) is using the derivative of the rotation to do the translation
Or simply changing the sensitivity of the translation

Personally I plan to use this for navigating my screen rather than FPS so maybe we could start with an algo that works for that and go from there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants