Files
Temp.BattleRoyale.Map.Unity/Assets/HPA/Character/Script/Camera/AP_Cam_Follow.cs

22 lines
670 B
C#
Raw Normal View History

2024-05-13 01:28:33 +08:00
// Description : Cam_Follow.cs : use on camera to follow the player character
using UnityEngine;
namespace HP.Generics
{
public class AP_Cam_Follow : MonoBehaviour
{
public Transform target;
public float rotationDamping = 15;
void LateUpdate()
{
#region
if (target != null)
{
transform.position = Vector3.Lerp(transform.position, target.position, Time.deltaTime * rotationDamping);
transform.rotation = Quaternion.Lerp(transform.rotation, target.rotation, Time.deltaTime * rotationDamping);
}
#endregion
}
}
}