Is there a mathematical way to convert Gamepad Analog Stick Sensitivity using a math equation?
The Analog Stick X axis returns (-100 to 0 to 100), this control spins the angle of my player. However I've noticed -as a player- that its hard to make fine-tune adjustments.
So ideally I'd like to make it an exponential curve instead of a linear line. So I'd like 1-75 have less of an effect, and when the player goes to extreme left/right its the full 100. This is mainly to help aiming and to give the controls a more "touch" friendly feel.
Currently my code is:
Rotate max(1,(Gamepad.Axis(0,0) * Player.pTurnRate) * dt) clockwise
Rotate max(1,(abs(Gamepad.Axis(0,0)) * Player.pTurnRate) * dt) counter-clockwise
Sorry, I've always struggled with maths, I can usually understand it, if explained, but not great at coming up with the solution without help.
Any help would be greatly appreciated! tia
You can use quarp or cubic expressions, see this demo:
dop2000 I think that will work. It feels a lot nicer for smaller angle corrections. you are the best!
do you know if using the cubic expr every tick (for input) would cause any performance issues? I know sqrt() is a high performance function people have mentioned in the past.
It only becomes a problem if you are using it thousands of times per tick. Once should be absolutely fine.
Develop games in your browser. Powerful, performant & highly capable.
dop2000 thanks! this helps a lot!