Player moves too fast diagonally and accelerates too fast diagonally.

Guys. I have a Vector3 InputDir. the character always ends up going too fast when i move diagonal.

Also after trying to figure this out for a while I realized that there is actually another problem. Even after I make it so that the max sum of x and y is 1, i will still have a problem with the player being able to accelerate faster diagonally. Since I am using an Xbox controller, the sooner you move the joystick from the middle to the end, the sooner you reach the max speed. So even after I solve the first problem, the player can still reach the max speed faster if he moves diagonally. It would be greatly appreciated if someone could help, I’ve been stuck for a while now.

A value of 0.7 in each direction will give you a magnitude of 1, so your character is not actually going faster. If you don’t understand why this is the case you might need to brush up on trigonometry a little before getting into vectors too much.


A side note, using Normalise to calculate an input will always give you a magnitude of 1. Even subtle movements would be as if you had the joystick pushed all the way to an edge. ClampMagnitude is more appropriate, it give you a better range of joystick movement.


Your input values will be clamped right in the corners, past a point where they would give a diagonal movement more than 1 (think a circle inside a square) but most joysticks are not designed to give inputs passed that range anyway.

uh… no!

According to Pythagorean Triple, the length is ~1 when (x:~0.7 , y:~0.7). You’ve already called inputDir.normalized. There shouldn’t have any problem about moving too fast diagonally