Issue moving camera

Hey guys,
I have a game with a Canvas and a play button. When the play button is pressed, I want the camera to slowly move over to focus on the player character.

I’m running into an issue where whenever I click the play button, the camera is only moving incrementally, as opposed to moving fluidly in one sweeping motion like I’d envisioned. How would I fix this?

Please find my camera move script below, any help is much appreciated :slight_smile:

using UnityEngine;

public class MoveCamera : MonoBehaviour
{
    public Transform CameraPos;
    public float speed;
    
    public void MoveCam()
    {
        Debug.Log("cam move");
        transform.position = Vector3.MoveTowards(transform.position, CameraPos.position, speed * Time.deltaTime);
    }
}

thats on your camera? but you seem to have told the camera to move towards itself?

Remove that script and delete it.

Install Cinemachine package.

Create a Cinemachine Camera, set it to follow your character (see manual). Zero code, and you get all the AAA quality goodies like damping (smoothing), safe zones, etc.

In your code you would have to call MoveCam() from Update() for it to provide a smooth motion rather than just stepping a bit closer.

nah CameraPos is an empty gameobject that acts as the desired move location for my camera.

ok but you’re moving that to your camera, not the other way round