1
0
mirror of https://github.com/xiaopeng12138/MaiDXR.git synced 2025-02-15 02:12:37 +01:00
MaiDXR/Assets/Scripts/CameraSmooth.cs

15 lines
383 B
C#
Raw Normal View History

2022-01-16 18:34:39 +01:00
using UnityEngine;
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;
2022-01-16 18:34:39 +01:00
void FixedUpdate ()
{
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);
}
}