using UnityEngine; public class CameraController : MonoBehaviour { public Transform target; public Vector3 offset; public float sensitivity = 2f; private float currentRotation = 0f; private void LateUpdate() { // Kameranın pozisyonunu belirlemek için karaktere ve offsete göre bir pozisyona sahip olması gerekir transform.position = target.position + offset; // Kameranın dönmesi float horizontalMouse = Input.GetAxis("Mouse X") * sensitivity; target.Rotate(0f, horizontalMouse, 0f); currentRotation -= Input.GetAxis("Mouse Y") * sensitivity; currentRotation = Mathf.Clamp(currentRotation, -60f, 60f); // Kamera açısının sınırlandırılması transform.localEulerAngles = new Vector3(currentRotation, 0f, 0f); } }