I'm learning to use Unity3d and I want to rotate a cube diagonally so that it appears to be spinning diagonally when I press the left arrow key + q or right arrow key + w. Can anyone assist me with my query?
This is what I have at the moment:
void Update ()
{
if(Input.GetKey(KeyCode.UpArrow)) //move forward
transform.Translate(Vector3.forward * moveSpeed * Time.deltaTime);
if(Input.GetKey(KeyCode.DownArrow)) //move backward
transform.Translate(-Vector3.forward * moveSpeed * Time.deltaTime);
if(Input.GetKey(KeyCode.LeftArrow)) //turn left
transform.Rotate(Vector3.up, -turnSpeed * Time.deltaTime);
if(Input.GetKey(KeyCode.RightArrow)) //turn right
transform.Rotate(Vector3.up, turnSpeed * Time.deltaTime);
}
transform.Rotate's that you do, aren't working correctly? Or something else? - Steven Mills