using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class DynamicCamera : MonoBehaviour
|
|
{
|
|
public GameObject target;
|
|
public float camHeight;
|
|
|
|
void Start()
|
|
{
|
|
|
|
}
|
|
|
|
void Follow()
|
|
{
|
|
Vector3 tempDest = target.transform.position;
|
|
tempDest -= transform.forward * camHeight;
|
|
Vector3 destination = Vector3.Lerp(transform.position, tempDest, 10f * Time.deltaTime);
|
|
transform.position = destination;
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void FixedUpdate()
|
|
{
|
|
Follow();
|
|
}
|
|
}
|