I need the camera to zoom out -0.05 after each time an object is destroyed. I have a camera script and destroy object script. The camera script is below. Everything works fine other than zooming out. I would think the zoomOut function below would do it by subtracting from the z position, but it’s not working. Any help would be appreciated!
//Camera Script
public float xMin = -50f;
public float yMin = -50f;
public float xMax = 50f;
public float yMax = 50f;
private Transform target;
public destroy dotDestroy;
.
void Start(){
target = GameObject.Find("Player").transform;
}
void LateUpdate()
{
transform.position = new Vector3(Mathf.Clamp(target.position.x, xMin, xMax), Mathf.Clamp(target.position.y, yMin, yMax), transform.position.z);
}
public void zoomOut()
{
if (dotDestroy)
{
transform.localPosition -= new Vector3(0, 0, -0.05f);
}
}