xan1242 / NFS-XtendedInput

NFS (Black Box, MW & newer) - XInput Plugin
MIT License
101 stars 7 forks source link

Adjust for rounded analog stick range #26

Open TorutheRedFox opened 2 years ago

TorutheRedFox commented 2 years ago

the standard for xinput is that the corners have a shorter (about 75%) range than the cardinal directions, image

in game, this isn't really noticeable outside of debug world camera and maybe the world map

TorutheRedFox commented 2 years ago

some math to fix it maybe would be by separating the vector into a normalized vector and its magnitude, and then figuring out the correction factor by doing a dot product between (1,1) and abs(stickVec_nrm), and then multiplying the magnitude by (1+(dotProduct*diff)) where diff is the difference between the expected magnitude (1) and the actual magnitude (0.75-ish), then reassembling the vector by simply multiplying the normalized vector by the magnitude