Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class Spinner : MonoBehaviour {
- public GameObject cubespinner;
- // Use this for initialization
- void Start () {
- cubespinner = GameObject.Find("Cube");
- }
- // Update is called once per frame
- void Update () {
- if (Input.GetKey(KeyCode.LeftArrow))
- {
- cubespinner.transform.Rotate(0, 0, 60 * Time.deltaTime);
- }
- if (Input.GetKey(KeyCode.RightArrow))
- {
- cubespinner.transform.Rotate(0, 0, -60 * Time.deltaTime);
- }
- if (Input.GetKey(KeyCode.DownArrow))
- {
- cubespinner.transform.Translate(0, -10 * Time.deltaTime, 0);
- }
- if (Input.GetKey(KeyCode.UpArrow))
- {
- cubespinner.transform.Translate(0, 10 * Time.deltaTime, 0);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement