I have free camera that move and rotate around in level. In this script if tb = true, I want my camera to rotate to target. I need this camera rotate to face character it self. Like this image.
public Transform avatar1; // character
public Camera cam;
public bool tb;
void Start()
{
tb = false;
}
void Update()
{
if (tb == true)
{
StartCoroutine(bu1());
}
}
IEnumerator bu1()
{
cam.transform.position = Vector3.Lerp(cam.transform.position, new Vector3(avatar1.transform.position.x + 6, 10, avatar1.transform.position.z + 7), 0.1f);
// rotate camera to face character smoothly
yield return new WaitForSeconds(2);
tb = false;
}