MiniGames/Assets/Scripts/ChaseOn/ChaseCameraController.cs

21 lines
556 B
C#
Raw Permalink Normal View History

2025-07-30 01:38:12 +05:00
using UnityEngine;
public class ChaseCameraController : MonoBehaviour
{
public Transform player; // Reference to the player
public Vector3 offset = new Vector3(0, 2, 5); // Offset in front of the player
public float followSpeed = 5f;
void LateUpdate()
{
if (player == null) return;
Vector3 targetPos = player.position + offset;
2025-08-07 19:58:02 +05:00
transform.position = Vector3.Lerp( transform.position, targetPos, followSpeed * Time.deltaTime);
2025-07-30 01:38:12 +05:00
// transform.LookAt(player.position + Vector3.up * 1.5f);
}
}