Hello! I have a problem and I’m stuck on how to solve it. I have a script that makes the camera move from one position to another.
using UnityEngine;
using System.Collections;
public class inspectworldscript : MonoBehaviour {
public Vector3 desiredPosition;
public int speed;
public Camera camerax;
void Start ()
{
}
void Update ()
{
cameraMove();
}
public void cameraMove ()
{
camerax.transform.position = Vector3.Slerp(transform.position, desiredPosition, speed * Time.deltaTime);
}
}
When I add this script component to the camera, it works perfectly fine. However, when I add it to a sprite, the camera moves to a position with an extremely different z value. What is going on???
Thank you for helping!