ProjectSquareBall/Assets/Scripts/CamFollower.cs
2024-10-13 16:13:44 +05:30

31 lines
612 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CamFollower : MonoBehaviour
{
public Transform target;
Vector3 offset;
public float speed = 0.1f;
public static CamFollower instance;
private void Awake()
{
instance = this;
offset = transform.position - target.position;
}
void Start()
{
}
// Update is called once per frame
public void UpdateFrame ()
{
}
void FixedUpdate(){
transform.position = Vector3.Lerp(transform.position, target.position + offset, speed);
}
}