Pressing both vertical and horizontal axis slows down my move speed
Hello, I'm having an issue with my movement speed. (2D game) (Dualshock 4 D-Pad)
If I only press the Horizontal Axis the player moves at the correct speed. But, if I simultaneously press the Vertical Axis (for example pressing diagonals on the d-pad) , then the players movement slows down to approx. half speed.
(Note: this doesn't happen with "asdf" keys. But, only when using "Joystick Axis")
.I've tried:
void Update () {
Debug.Log(Input.GetAxisRaw("Horizontal"));
moveX = Input.GetAxisRaw("Horizontal");
moveY = Input.GetAxisRaw("Vertical");
if(moveX > 0)
{
moveX = 1;
}
else if(moveX < 0)
{
moveX = -1;
}
if(moveY > 0)
{
moveY = 1;
}
else if(moveY < 0)
{
moveY = -1;
}
}
This appears to be working in the inspector. But in the Console I can see that when pressing "Diagonals" on the D-pad, I get values of 0.6384034. (Which is why I get approx. half speed movement).
I would like for the players speed to not be affected by the Vertical Axis. Any help is greatly appreciated. Thanks.
Your answer
Follow this Question
Related Questions
How to move a game object to a position after selecting it 0 Answers
Help changing input to axis 0 Answers
Make the Player rotate with right xbox stick and move with left xbox stick 0 Answers
Mouse controlled 2D object bleeding through walls 1 Answer
How to make my float return to it's original value after being changed. 1 Answer