Hello!
When holding down A my object rotates to the left, when i hold in D my object should rotate right but it does not:
if (Input.GetKey(KeyCode.A)){
Debug.Log("left");
Quaternion Temp = transform.rotation;
Temp.z += Time.deltaTime;
transform.rotation = Temp;
}
if (Input.GetKey(KeyCode.D)){
Debug.Log("Right");
Quaternion Temp = transform.rotation;
Temp.z -= Time.deltaTime;
transform.rotation = Temp;
}
When holding down D in game mode the object immideatly rotates 360 degrees and “shakes” when i continue holding down D. I want the object to gradualy get a negative rotation around the Z-axis when holding down D, just as i get when i hold down A (but the opposite).
What would i do to fix this?
Thank you!