From 1b70ad916e5da381802e76f140740e487ca8e581 Mon Sep 17 00:00:00 2001 From: Parkillhwan Date: Wed, 23 Apr 2025 14:22:31 +0900 Subject: [PATCH] =?UTF-8?q?DEG-81=20=EC=B9=B4=EB=A9=94=EB=9D=BC=20?= =?UTF-8?q?=EC=BB=A8=ED=8A=B8=EB=A1=A4=EB=9F=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/PIH.meta | 8 ++++++++ Assets/PIH/CameraController.cs | 29 +++++++++++++++++++++++++++++ Assets/PIH/CameraController.cs.meta | 11 +++++++++++ 3 files changed, 48 insertions(+) create mode 100644 Assets/PIH.meta create mode 100644 Assets/PIH/CameraController.cs create mode 100644 Assets/PIH/CameraController.cs.meta diff --git a/Assets/PIH.meta b/Assets/PIH.meta new file mode 100644 index 00000000..083cefc0 --- /dev/null +++ b/Assets/PIH.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 214766d638d7daf41bb335b483002e18 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/PIH/CameraController.cs b/Assets/PIH/CameraController.cs new file mode 100644 index 00000000..0200ac39 --- /dev/null +++ b/Assets/PIH/CameraController.cs @@ -0,0 +1,29 @@ +using UnityEngine; + +public class CameraController : MonoBehaviour +{ + public Transform target; + public Vector3 offset = new Vector3(0f, 10f, -10f); + public float smoothSpeed = 5f; + + public Vector2 minBoundary = new Vector2(-50f, -50f); + public Vector2 maxBoundary = new Vector2(50f, 50f); + + void Start() + { + // X축으로 55도 회전 + transform.rotation = Quaternion.Euler(55f, 0f, 0f); + } + + void LateUpdate() + { + if (target == null) + return; + + Vector3 desiredPosition = target.position + offset; + desiredPosition.x = Mathf.Clamp(desiredPosition.x, minBoundary.x, maxBoundary.x); + desiredPosition.z = Mathf.Clamp(desiredPosition.z, minBoundary.y, maxBoundary.y); + + transform.position = Vector3.Lerp(transform.position, desiredPosition, Time.deltaTime * smoothSpeed); + } +} \ No newline at end of file diff --git a/Assets/PIH/CameraController.cs.meta b/Assets/PIH/CameraController.cs.meta new file mode 100644 index 00000000..ccdb26ee --- /dev/null +++ b/Assets/PIH/CameraController.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8b45463c9e39f224291703edb69fdbf0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: