Why does my player move differently than i command?
My character, which is the shape of a car, moves forward and backward when i press the corresponding keys, and when I press the left arrow key the player moves forward and to the left, while curving, like in a circle moving (counterclockwise and Forward) starting as if at 3 oclock and pointed upwards. The problem is when I press the right arrow key, the player moves (Backwards in a clockwise position) as if starting at 3 oclock and pointed upwards. Can someone tell me why this is happening?
(This was written in notepad if that makes a difference)
Thanks for your help
Here is the code I used ( Javascript );
//Javascript; #pragma strict
var forwardRate : float = 25; var turnRate : float = 5;
function Update () {
// forward speed of player var forwardMoveAmount = Input.GetAxis("Vertical") * forwardRate;
// how fast player turns var turnForce = Input.GetAxis("Horizontal") * turnRate;
// rotate player transform.Rotate(0, turnForce, 0);
transform.position += transform.forward forwardMoveAmount Time.deltaTime;
}
Your answer
Follow this Question
Related Questions
Really confusing float question 1 Answer
Face player to movement while not turning character controller 0 Answers
Mobile touch 0 Answers