Hi, newb here. My scene begins with a cube rotating in the middle of the screen. On a key press, the cube successfully faces the camera, but will not stop rotating. How can I get the cube to stop rotating at a button press? Thanks!
public bool rotateCube = true;
void Update ()
{
if (rotateCube = true)
{
transform.Rotate(new Vector3(30, 30, 10) * Time.deltaTime);
}
if(Input.anyKey)
{
Debug.Log("Any Key has been pressed");
transform.rotation = Quaternion.LookRotation(-Camera.main.transform.forward, Camera.main.transform.up);
rotateCube = false;
}
}