1
0
mirror of https://github.com/xiaopeng12138/MaiDXR.git synced 2024-11-27 20:40:48 +01:00
MaiDXR/Assets/Scripts/CameraSmooth.cs

15 lines
424 B
C#

using UnityEngine;
[RequireComponent(typeof(Camera))]
public class CameraSmooth : MonoBehaviour {
public Transform target;
public float smoothSpeed = 0.1f;
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);
}
}