2022-07-26 15:13:45 +02:00
|
|
|
using UnityEngine;
|
|
|
|
[RequireComponent(typeof(Camera))]
|
|
|
|
public class CameraSmooth : MonoBehaviour {
|
|
|
|
|
|
|
|
public Transform target;
|
2022-10-07 17:12:42 +02:00
|
|
|
public float smoothSpeed = 0.05f;
|
2022-07-26 15:13:45 +02:00
|
|
|
public int FPS = 60;
|
|
|
|
private void Start()
|
|
|
|
{
|
|
|
|
QualitySettings.vSyncCount = 0;
|
|
|
|
Application.targetFrameRate = FPS;
|
|
|
|
}
|
|
|
|
void Update ()
|
|
|
|
{
|
2022-08-01 23:44:03 +02:00
|
|
|
if (target == null) return;
|
2022-10-07 17:12:42 +02:00
|
|
|
transform.position = Vector3.Lerp(transform.position, target.position, smoothSpeed);
|
2022-07-26 15:13:45 +02:00
|
|
|
transform.rotation = Quaternion.Lerp(transform.rotation, target.rotation, smoothSpeed);
|
|
|
|
}
|
|
|
|
}
|