1
0
mirror of https://github.com/xiaopeng12138/MaiDXR.git synced 2025-02-26 06:28:04 +01:00
MaiDXR/Assets/Scripts/CameraSmooth.cs

22 lines
565 B
C#
Raw Normal View History

2022-01-16 18:34:39 +01:00
using UnityEngine;
[RequireComponent(typeof(Camera))]
public class CameraSmooth : MonoBehaviour {
2022-01-16 18:34:39 +01:00
public Transform target;
public float smoothSpeed = 0.125f;
2022-03-04 21:18:48 +01:00
public Vector3 PositionOffset;
public int FPS = 60;
2022-08-04 23:38:59 +02:00
float elapsed;
Camera cam;
private void Start()
{
2022-08-04 23:38:59 +02:00
QualitySettings.vSyncCount = 1;
//Application.targetFrameRate = FPS;
}
2022-03-09 20:52:38 +01:00
void Update ()
2022-01-16 18:34:39 +01:00
{
2022-03-04 21:18:48 +01:00
transform.position = Vector3.Lerp(transform.position, target.position + PositionOffset, smoothSpeed);
2022-01-16 18:34:39 +01:00
transform.rotation = Quaternion.Lerp(transform.rotation, target.rotation, smoothSpeed);
}
}