1
0
mirror of https://github.com/xiaopeng12138/MaiDXR.git synced 2024-12-18 20:05:52 +01:00
MaiDXR/Assets/Scripts/Essentias/CameraSmooth.cs

15 lines
427 B
C#
Raw Normal View History

2022-08-12 02:20:00 +02:00
using UnityEngine;
[RequireComponent(typeof(Camera))]
public class CameraSmooth : MonoBehaviour {
public Transform target;
2022-08-27 00:17:18 +02:00
public float smoothSpeed = 0.0125f;
2022-08-12 02:20:00 +02:00
public Vector3 PositionOffset;
Camera cam;
void Update ()
{
transform.position = Vector3.Lerp(transform.position, target.position + PositionOffset, smoothSpeed);
transform.rotation = Quaternion.Lerp(transform.rotation, target.rotation, smoothSpeed);
}
}