How to : Camera Follows Player Smoothly in Unity3D

Hi, in this video I’ll share with you some useful C# script for your Unity3D game camera so your camera can follow the player’s movements smoothly.

Watch this video:

Here is the codes:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CamFollowsPlayer : MonoBehaviour {

    public Transform cameraTarget;
    public float sSpeed = 10.0f;
    public Vector3 dist;
    public Transform lookTarget;

    void FixedUpdate() {
        Vector3 dPos = cameraTarget.position + dist;
        Vector3 sPos = Vector3.Lerp(transform.position, dPos, sSpeed * Time.deltaTime);
        transform.position = sPos;


Leave a Reply

Your email address will not be published. Required fields are marked *