25 lines
502 B
C#
25 lines
502 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;
|
|
private void Awake()
|
|
{
|
|
offset = transform.position - target.position;
|
|
}
|
|
void Start()
|
|
{
|
|
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
transform.position = Vector3.Lerp(transform.position, target.position + offset, speed);
|
|
}
|
|
}
|