Hello everyone, I’m trying to control a tank from birdseyeview, but i simple have problems.
My tank’s normal rotation’s are :
x 0 y 90 z 0
here is my code :
function Update () {
if (Input.GetKey("w")){
transform.Translate(Vector3.forward*Time.deltaTime*2.5);
transform.rotation.y=90;
}
if (Input.GetKey("a")){
transform.Translate(Vector3.forward*Time.deltaTime*2.5);
transform.rotation.y=0;
}
if (Input.GetKey("d")){
transform.Translate(Vector3.forward*Time.deltaTime*2.5);
transform.rotation.y=180;
}
}
If I press “a” it goes left, OK.
If I press “d” it goes right,OK.
But if I press “w” it goes right, it doesn’t go forward in the 90 y rotation. What can be the problem ?