mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-22 21:15:57 +00:00
Level the six-axis orientation from the first real accelerometer reading and pull it toward gravity at 4/s while the controller is held still, so a bow aimed right after the game starts or after a load no longer turns sideways when the controller is tilted up or down
This commit is contained in:
1 parent
6b0974f08d
commit
b155be1881
3 files changed
+42
-15
No files matched your search
+6
-4
@@ -1025,10 +1025,12 @@ static int sensors_ready(void) {
|
||||
sensor_ok =SDL_GamepadHasSensor(pad, SDL_SENSOR_GYRO) && SDL_GamepadHasSensor(pad, SDL_SENSOR_ACCEL) &&
|
||||
SDL_SetGamepadSensorEnabled(pad, SDL_SENSOR_GYRO, true) &&
|
||||
SDL_SetGamepadSensorEnabled(pad, SDL_SENSOR_ACCEL, true);
|
||||
if (sensor_ok) rt_log("input: motion sensors on (gyro %.0f Hz, accelerometer %.0f Hz)",
|
||||
(double)SDL_GetGamepadSensorDataRate(pad, SDL_SENSOR_GYRO),
|
||||
(double)SDL_GetGamepadSensorDataRate(pad, SDL_SENSOR_ACCEL));
|
||||
else rt_log("input: \"%s\" has no gyro and accelerometer: the six-axis sensor reads a controller at rest",
|
||||
if (sensor_ok) {
|
||||
rt_log("input: motion sensors on (gyro %.0f Hz, accelerometer %.0f Hz)",
|
||||
(double)SDL_GetGamepadSensorDataRate(pad, SDL_SENSOR_GYRO),
|
||||
(double)SDL_GetGamepadSensorDataRate(pad, SDL_SENSOR_ACCEL));
|
||||
motion_restart(motion_global()); // another controller: its own orientation, from its first reading
|
||||
} else rt_log("input: \"%s\" has no gyro and accelerometer: the six-axis sensor reads a controller at rest",
|
||||
SDL_GetGamepadName(pad));
|
||||
return sensor_ok;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user