Replace uAxisThreshold with appropriate constant for octagon clamping (#83)

This commit is contained in:
kev4cards 2022-03-29 22:23:40 -04:00 committed by GitHub
parent 98ddacef01
commit 5505336a8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -143,8 +143,8 @@ namespace Ship {
//bound diagonals to an octagonal range {-68 ... +68} //bound diagonals to an octagonal range {-68 ... +68}
if (ax != 0.0 && ay != 0.0) { if (ax != 0.0 && ay != 0.0) {
auto slope = ay / ax; auto slope = ay / ax;
auto edgex = copysign(85.0 / (abs(slope) + wAxisThreshold / 69.0), ax); auto edgex = copysign(85.0 / (abs(slope) + 16.0 / 69.0), ax);
auto edgey = copysign(std::min(abs(edgex * slope), 85.0 / (1.0 / abs(slope) + wAxisThreshold / 69.0)), ay); auto edgey = copysign(std::min(abs(edgex * slope), 85.0 / (1.0 / abs(slope) + 16.0 / 69.0)), ay);
edgex = edgey / slope; edgex = edgey / slope;
auto scale = sqrt(edgex * edgex + edgey * edgey) / 85.0; auto scale = sqrt(edgex * edgex + edgey * edgey) / 85.0;
@ -410,4 +410,4 @@ namespace Ship {
std::string SDLController::GetBindingConfSection() { std::string SDLController::GetBindingConfSection() {
return GetControllerType() + " CONTROLLER BINDING " + guid; return GetControllerType() + " CONTROLLER BINDING " + guid;
} }
} }