|
Hey guys. I'm still learning Unity, using JavaScript. I'm trying to make a character that you rotate with the left, and right, arrow keys, and then you press up, and he moves forward. I kind of have it working, but not quite. The problem is, once you rotate around so much, then the character starts moving in a different direction, than he is facing. I don't really know how to explain it better than that, other than the direction he is moving, and the direction he is facing, is not matching up. Here's the code I've even tried removing the "* Time.deltaTime * turnSpeed" But it's just the same result. Any help would be appreciated.
(comments are locked)
|
|
I am not sure whether i have correctly understood you question, but you can try this. Replace the movement code as follows: if (Input.GetKey(KeyCode.UpArrow)) { transform.position += transform.forward * Time.deltaTime * walkSpeed; } Do let me know if it solved the issue.
(comments are locked)
|
