UPF/Assets/Game/Scripts/Minigame/CameraFollower.cs
2022-06-09 03:05:55 +05:30

22 lines
527 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraFollower : MonoBehaviour
{
public bool autoOffset = true;
public Vector3 offset;
public Transform target;
public float smoothness = 0.1f;
void Start()
{
offset = transform.position - target.position;
}
// Update is called once per frame
void Update()
{
transform.position = Vector3.Lerp(transform.position, target.position + offset, smoothness * Time.deltaTime);
}
}