1
0
mirror of synced 2024-12-14 07:12:54 +01:00
WACVR/Assets/Script/Camera/CameraSmooth.cs

21 lines
562 B
C#
Raw Normal View History

using UnityEngine;
[RequireComponent(typeof(Camera))]
public class CameraSmooth : MonoBehaviour {
public Transform target;
public float smoothSpeed = 0.125f;
public Vector3 PositionOffset;
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;
transform.position = Vector3.Lerp(transform.position, target.position + PositionOffset, smoothSpeed);
transform.rotation = Quaternion.Lerp(transform.rotation, target.rotation, smoothSpeed);
}
}