Im trying to make my camera thats stuck to my player turn around it 45 degrees whenever i press Q or E. but for some reason i cant get it to work. im using C#.
using UnityEngine;
using System.Collections;
public class Camera : MonoBehaviour
{
int rotatespeed = 3;
int rotationstart = 90;
public GameObject player;
private Vector3 offset;
// Use this for initialization
void Start()
{
offset = transform.position - player.transform.position;
}
// Update is called once per frame
void LateUpdate() {
transform.position = player.transform.position + offset;
}
void Update()
{
if (Input.GetKey("q"))
{
Camera.main.transform.rotation = Quaternion.Euler(x + 45 , y, z);
}
if (Input.GetKey("e"))
{
Camera.main.transform.rotation = Quaternion.Euler(x - 45, y, z);
}
}
}