Skip to content
Permalink
dfa3314e63
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
39 lines (32 sloc) 933 Bytes
using UnityEngine;
using System.Collections;
public class LeftyRighty : MonoBehaviour {
public Camera mainCam;
bool STFU;
public float yAngle = 0.0f;
// Use this for initialization
void Start () {
mainCam = Camera.main;
gameObject.transform.localEulerAngles = new Vector3(0, yAngle, 0);
}
// Update is called once per frame
void Update () {
if (STFU == true) {
mainCam.transform.Rotate(Vector3.up, Time.deltaTime, Space.World);
}
if(Input.GetKeyDown(KeyCode.RightArrow))
{
STFU = true;
yAngle = yAngle + 30;
gameObject.transform.localEulerAngles = new Vector3(0, yAngle, 0);
Debug.Log ("right");
}
if (Input.GetKeyDown(KeyCode.LeftArrow))
{
STFU = true;
yAngle = yAngle - 30;
gameObject.transform.localEulerAngles = new Vector3(0, yAngle , 0);
Debug.Log("left");
}
}
}