I want to make camera follow the object without change rotation.
using UnityEngine;
using System.Collections;
public class CameraScript : MonoBehaviour
{
public Transform target;
private Vector3 offset;
void Update ()
{
if(Input.GetKey(KeyCode.RightArrow))
{
transform.RotateAround(target.position, Vector3.down, 60 * Time.deltaTime);
}
else if(Input.GetKey(KeyCode.LeftArrow))
{
transform.RotateAround(target.position, Vector3.up, 60 * Time.deltaTime);
}
}
}
Please help me.
Thanks very much.