1
0
mirror of https://github.com/xiaopeng12138/MaiDXR.git synced 2024-12-19 04:15:53 +01:00
MaiDXR/Assets/Scripts/CameraFollow.cs

15 lines
383 B
C#
Raw Normal View History

2022-01-16 18:34:39 +01:00
using UnityEngine;
public class CameraFollow : MonoBehaviour {
public Transform target;
public float smoothSpeed = 0.125f;
public Vector3 PosotionOffset;
void FixedUpdate ()
{
transform.position = Vector3.Lerp(transform.position, target.position + PosotionOffset, smoothSpeed);
transform.rotation = Quaternion.Lerp(transform.rotation, target.rotation, smoothSpeed);
}
}