ComponentList 완료, Context 메뉴 추가
This commit is contained in:
@@ -15,39 +15,58 @@ namespace UVC.Factory
|
||||
{
|
||||
[Header("Panning Speed")]
|
||||
[Tooltip("카메라 높이가 임계값보다 낮을 때의 평행 이동 속도")]
|
||||
public float lowAltitudePanSpeed = 0.5f;
|
||||
[SerializeField]
|
||||
private float lowAltitudePanSpeed = 0.5f;
|
||||
|
||||
[Tooltip("카메라 높이가 임계값보다 높을 때의 평행 이동 속도")]
|
||||
public float highAltitudePanSpeed = 10f;
|
||||
[SerializeField]
|
||||
private float highAltitudePanSpeed = 10f;
|
||||
|
||||
[Tooltip("카메라 회전 속도")]
|
||||
public float rotationSpeed = 300f;
|
||||
[SerializeField]
|
||||
private float rotationSpeed = 300f;
|
||||
|
||||
[Tooltip("카메라 줌 속도")]
|
||||
public float zoomSpeed = 10f;
|
||||
[SerializeField]
|
||||
private float zoomSpeed = 10f;
|
||||
|
||||
[Header("Movement Smoothing")]
|
||||
[Tooltip("패닝 시 마우스 이동량의 최대값을 제한하여, 프레임 드랍 시 카메라가 급격하게 튀는 현상을 방지합니다.")]
|
||||
public float maxPanDelta = 50f;
|
||||
[SerializeField]
|
||||
private float maxPanDelta = 50f;
|
||||
|
||||
[Header("Camera")]
|
||||
[Tooltip("카메라 최소 높이")]
|
||||
public float minCameraY = 2f;
|
||||
[SerializeField]
|
||||
private float minCameraY = 2f;
|
||||
|
||||
[Tooltip("카메라 최대 높이")]
|
||||
public float maxCameraY = 50f;
|
||||
[SerializeField]
|
||||
private float maxCameraY = 50f;
|
||||
|
||||
[Tooltip("카메라의 최소 수직 회전 각도 (X축)")]
|
||||
public float minPitch = 20f;
|
||||
[SerializeField]
|
||||
private float minPitch = 20f;
|
||||
|
||||
[Tooltip("카메라의 최대 수직 회전 각도 (X축)")]
|
||||
public float maxPitch = 85f;
|
||||
[SerializeField]
|
||||
private float maxPitch = 85f;
|
||||
|
||||
[Tooltip("카메라의 최소 수평 회전 각도 (y축)")]
|
||||
public float minYaw = -45f;
|
||||
[SerializeField]
|
||||
private float minYaw = -45f;
|
||||
|
||||
[Tooltip("카메라의 최대 수평 회전 각도 (y축)")]
|
||||
public float maxYaw = 45f;
|
||||
[SerializeField]
|
||||
private float maxYaw = 45f;
|
||||
|
||||
[Tooltip("마우스를 이용 한 회전 사용 여부")]
|
||||
[SerializeField]
|
||||
public bool EnabledRotation = true;
|
||||
|
||||
[Tooltip("마우스를 이용 한 확대/축소 사용 여부")]
|
||||
[SerializeField]
|
||||
public bool EnabledZoom = true;
|
||||
|
||||
/// <summary>
|
||||
/// 카메라의 변형이 변경될 때 발생합니다.
|
||||
@@ -211,8 +230,8 @@ namespace UVC.Factory
|
||||
{
|
||||
if (!Enable) return; // 카메라 컨트롤이 비활성화된 경우, 업데이트를 건너뜁니다.
|
||||
HandlePanning();
|
||||
HandleRotation();
|
||||
HandleZoom();
|
||||
if (EnabledRotation) HandleRotation();
|
||||
if (EnabledZoom) HandleZoom();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -407,7 +426,7 @@ namespace UVC.Factory
|
||||
/// <param name="equipmentPosition">포커스할 대상의 Transform</param>
|
||||
/// <param name="distance">대상과의 거리</param>
|
||||
/// <param name="duration">이동에 걸리는 시간(초), 기본값 1초</param>
|
||||
public void FocusOnTarget(Vector3 equipmentPosition, float distance, float duration = 1.0f)
|
||||
public void FocusOnTarget(Vector3 equipmentPosition, float distance, float duration = 1.0f, bool keepYRotation = true)
|
||||
{
|
||||
if (equipmentPosition == null) return;
|
||||
|
||||
@@ -424,7 +443,7 @@ namespace UVC.Factory
|
||||
}
|
||||
|
||||
// 코루틴을 사용하여 부드러운 이동 구현
|
||||
focusCoroutine = StartCoroutine(SmoothFocusOnTarget(position, distance, duration));
|
||||
focusCoroutine = StartCoroutine(SmoothFocusOnTarget(position, distance, duration, keepYRotation));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -452,7 +471,7 @@ namespace UVC.Factory
|
||||
/// <summary>
|
||||
/// 부드럽게 타겟까지 이동하는 코루틴
|
||||
/// </summary>
|
||||
private IEnumerator SmoothFocusOnTarget(Vector3 targetTransform, float distance, float duration)
|
||||
private IEnumerator SmoothFocusOnTarget(Vector3 targetTransform, float distance, float duration, bool keepYRotation = true)
|
||||
{
|
||||
// 카메라가 바라볼 대상의 중심점
|
||||
Vector3 targetPosition = targetTransform;
|
||||
@@ -467,6 +486,14 @@ namespace UVC.Factory
|
||||
|
||||
// 최종 회전값 계산
|
||||
Quaternion endRotation = Quaternion.LookRotation(targetPosition - endPosition);
|
||||
|
||||
if (keepYRotation)
|
||||
{
|
||||
Vector3 euler = endRotation.eulerAngles;
|
||||
euler.y = 0; // Y축 회전각을 0으로 설정
|
||||
endRotation = Quaternion.Euler(euler);
|
||||
}
|
||||
|
||||
endRotation = ValidateRotation(endRotation); // 회전값 검증 및 수정
|
||||
|
||||
// 이동 시간 계산을 위한 변수
|
||||
@@ -493,6 +520,13 @@ namespace UVC.Factory
|
||||
transform.position = endPosition;
|
||||
transform.LookAt(targetPosition);
|
||||
|
||||
if (keepYRotation)
|
||||
{
|
||||
Vector3 finalEuler = transform.eulerAngles;
|
||||
finalEuler.y = 0;
|
||||
transform.rotation = Quaternion.Euler(finalEuler);
|
||||
}
|
||||
|
||||
// 회전 피봇 포인트 업데이트
|
||||
rotationPivot = targetPosition;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user