using UnityEngine; public class BlackjackDialogHudFix : MonoBehaviour { [Header("Anchor")] public Transform speakerAnchor; // ÈÄÅ© ±âÁØ À§Ä¡ public Camera targetCamera; // ºñ¿öµÎ¸é Camera.main »ç¿ë [Header("Panel Check")] public GameObject dialoguePanel; // DialoguePanel ³Ö±â public bool onlyWhenPanelActive = true; [Header("Placement")] public float chestHeight = 2.0f; public float forwardOffset = 0.7f; public float lateralOffset = 0f; private void LateUpdate() { if (speakerAnchor == null) return; if (onlyWhenPanelActive && dialoguePanel != null && !dialoguePanel.activeInHierarchy) return; Camera cam = targetCamera != null ? targetCamera : Camera.main; if (cam == null) return; Vector3 toCam = cam.transform.position - speakerAnchor.position; toCam.y = 0f; if (toCam.sqrMagnitude < 0.0001f) return; Vector3 dir = toCam.normalized; Vector3 right = Vector3.Cross(Vector3.up, dir).normalized; Vector3 chestWorld = speakerAnchor.position + Vector3.up * chestHeight; transform.position = chestWorld + dir * forwardOffset + right * lateralOffset; transform.rotation = Quaternion.LookRotation(-dir); } }