using System.Collections; using System.Collections.Generic; using UnityEngine; public class cubecontroller : MonoBehaviour { float rotSpeed = 90; // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.UpArrow)){ transform.Rotate(this.rotSpeed,0,0); } if (Input.GetKeyDown(KeyCode.DownArrow)){ transform.Rotate(-this.rotSpeed,0,0); } if (Input.GetKeyDown(KeyCode.RightArrow)){ transform.Rotate(0, -this.rotSpeed,0); } if (Input.GetKeyDown(KeyCode.LeftArrow)){ transform.Rotate(0, this.rotSpeed,0); } if (Input.GetKeyDown(KeyCode.Space)){ //transform.Rotate(0, 0 ,0); this.transform.rotation = Quaternion.Euler(new Vector3(0, 0, 0)); } } public void upsee() { this.transform.rotation = Quaternion.Euler(new Vector3(-90.0f, 0, 0)); } public void downsee() { this.transform.rotation = Quaternion.Euler(new Vector3(90.0f, 0, 0)); } public void originsee() { this.transform.rotation = Quaternion.Euler(new Vector3(0, 0, 0)); } public void leftsee() // 左視圖 { this.transform.rotation = Quaternion.Euler(new Vector3(0, -90.0f, 0)); } public void rightsee() // 右試圖 { this.transform.rotation = Quaternion.Euler(new Vector3(0, 90.0f, 0)); } }