Camera Orbit C# Unity

using UnityEngine;
using System.Collections;
public class CameraOrbit : MonoBehaviour {
public GameObject target = null;
public bool orbitY = false;
// Use this for initialization
void Start () {
System.GC.Collect();
}
// Update is called once per frame
void Update () {
if (target != null)
{
transform.LookAt(target.transform);
if (orbitY)
{
transform.RotateAround(target.transform.position, Vector3.up, Time.deltaTime * 5);
}
}
}
}
Add your comment

Your email address will not be published. Required fields are marked *