Hi guys,
I wrote the below script to move the main camera towards the player incrementally.
float step = speed * Time.deltaTime;
Vector3 temp = new Vector3(transform.position.x, transform.position.y, target.transform.position.z);
transform.position = Vector3.MoveTowards(transform.position, temp, step);
however i am unable to limit the max distance between the camera and the player.
any suggestions on how to do this? I want to make it so that when the camera reaches the player, the character dies.
Oh and my character is currently running along the z axis.
Thanks for your help!