2026-03-17 시네머신 카메라 묶음 수정. 여러 카메라릭에서 공유하도록 공통 시네머신카메라리스트 분리
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
using Unity.Cinemachine;
|
||||
using UnityEditor.Rendering;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class CameraManager : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private AimCameraRig _currentCameraRig; //현재 활성화된 플레이어의 카메라 묶음 조종객체
|
||||
private CameraRigBase _currentCameraRig; //현재 활성화된 플레이어의 카메라 묶음 조종객체
|
||||
|
||||
private float minFOV = 40f;
|
||||
private float maxFOV = 100f;
|
||||
@@ -12,6 +13,32 @@ public class CameraManager : MonoBehaviour
|
||||
private void Awake()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_ = InitializeCameraRig();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private async Awaitable InitializeCameraRig()
|
||||
{
|
||||
CinemachineBrain brain = Camera.main.GetComponent<CinemachineBrain>();
|
||||
|
||||
while (brain.ActiveVirtualCamera == null)
|
||||
{
|
||||
await Awaitable.NextFrameAsync();
|
||||
}
|
||||
|
||||
if (brain.ActiveVirtualCamera is CinemachineCamera cam)
|
||||
{
|
||||
_currentCameraRig = cam.GetComponentInParent<CameraRigBase>();
|
||||
}
|
||||
}
|
||||
|
||||
public void OnSceneLoaded(Scene scene, LoadSceneMode mode)
|
||||
@@ -26,13 +53,12 @@ public void SetCameraRig(AimCameraRig cameraRig)
|
||||
|
||||
public void ZoomCamera(float offset)
|
||||
{
|
||||
_currentCameraRig.CurrentFOV = Mathf.Clamp(_currentCameraRig.CurrentFOV - offset, minFOV,maxFOV);
|
||||
if (_currentCameraRig is AimCameraRig rig)
|
||||
{
|
||||
rig.CurrentFOV = Mathf.Clamp(rig.CurrentFOV - offset, minFOV, maxFOV);
|
||||
}
|
||||
}
|
||||
|
||||
public void RecenterPlayer()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Vector3 GetViewportPointToRayEndPoint(Vector3 vpPoint,float rayLength)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user