- Home /
My Players speed differs depending on the input method (gamepad or keyboard)
My game involves long/high parabolic jumps. I designed the levels using the keyboard as the primary method of player control. However, I just tested the game with an Xbox One controller (wired) - and I noticed that the players max speed is reduced. Meaning the distance the player travels (while jumping) is about 25% less when using the Xbox controller than it is when I use a keyboard. The player speed while walking on the ground is also slower when using the xbox controller. I assume this has something to do with the max x/y axis values of the controller - but I am not sure where to look for a fix.
Any insight or direct to fix this issue would be greatly appreciated.
I imagine it's more likely to do with the way you're normalising (or not) the diagonal vector (1,1).
Answer by Zoelovezle · Jan 05, 2016 at 12:09 PM
I assume you have multiplied a vector which changes its value to with your speed. Say your speed is 5
If you multiply speed with with Vector3(1,0,0) * speed it will give you the max speed i.e. Vector3(1,0,0)*5 = Vector3(5,0,0)
Similarly for Vector3(0,1,0) and Vector(1,1,0) and they will give Vector3(0,5,0) & Vector3(5,5,0)
Now suppose your Vector3 is acting as direction is normalized using Vector3.Normalize .
Lets say that Vector is Vector3(0.4, 0.3 ,0) now if you multiply with speed , i.e. Vector3(0.4, 0.3 ,0)*5 = Vector3(2,1.5f,0) .
Now its clear the speed will decrease according to the Normalized direction.