mirror of
https://github.com/xiaopeng12138/MaiDXR.git
synced 2024-12-20 21:05:51 +01:00
15 lines
424 B
C#
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);
|
|
}
|
|
}
|