mirror of
https://github.com/xiaopeng12138/MaiDXR.git
synced 2024-11-24 03:50:10 +01:00
22 lines
563 B
C#
22 lines
563 B
C#
using UnityEngine;
|
|
[RequireComponent(typeof(Camera))]
|
|
public class CameraSmooth : MonoBehaviour {
|
|
|
|
public Transform target;
|
|
public float smoothSpeed = 0.125f;
|
|
public Vector3 PositionOffset;
|
|
public int FPS = 60;
|
|
float elapsed;
|
|
Camera cam;
|
|
private void Start()
|
|
{
|
|
QualitySettings.vSyncCount = 0;
|
|
Application.targetFrameRate = FPS;
|
|
}
|
|
void Update ()
|
|
{
|
|
transform.position = Vector3.Lerp(transform.position, target.position + PositionOffset, smoothSpeed);
|
|
transform.rotation = Quaternion.Lerp(transform.rotation, target.rotation, smoothSpeed);
|
|
}
|
|
}
|