I need help with controller support on my game. The problem I ran into is I was using key-presses to keep track of which direction the player is facing. So when you move left the player faces left and when you move right he faces right. But when you use the controller it’s using the axis to move. and it sends a -1 to move left and 1 to move right and 0 is standing still. How do I keep track of which value I am getting from the axis? The keyboard part is simple but i can’t figure out the axis. My guy is moving but he is not flipping when i move left.
Hi @Jared_Kellen,
Why not just compare the axis value returned to zero? e.g. if the value is < zero - face left. If it is > zero - face right?
I’m confused on how i get that value? Can i use the value from rightMovement?
if (rightMovement > 0) {
…
}
Why not try outputting Input.GetAxisRaw("Horizontal") to the console and see what you get.
Assuming this is the -1 or 0 or 1 range etc, store that in a variable.
Then compare that in the if logic like you outlined.
I wouldn’t personally use the variable name rightMovement because it isn’t always going to be right, there will be cases when its left, or not at all.
Updated Thu Feb 16 2017 19:59
Depending on your game you may want to just use Input.GetAxis instead of Input.GetAxisRaw also due to the smoothing, but again, it would depend on your game / requirements. 
Fab… glad you got it working Jared 
You can paste your code into your posts on here Jared btw, use the “preformatted text” tool and it will beautify it also 


