2026-03-17 14:19 FPS시점의 Strafe캐릭터 조작과 에임모드 전환
This commit is contained in:
@@ -5,8 +5,6 @@
|
||||
|
||||
public class AimCameraRig : CameraRigBase
|
||||
{
|
||||
public InputAxis AimMode = InputAxis.DefaultMomentary; //누르는 동안만 유지
|
||||
|
||||
[SerializeField] private CinemachineCamera _aimCamera;
|
||||
[SerializeField] private CinemachineCamera _freeCamera;
|
||||
|
||||
@@ -16,7 +14,7 @@ public class AimCameraRig : CameraRigBase
|
||||
|
||||
public CinemachineCamera ActiveCmCamera => LiveChild as CinemachineCamera;
|
||||
|
||||
private bool _isAiming => AimMode.Value > 0.5f;
|
||||
private bool _isAiming => _controller != null && _controller.IsAiming;
|
||||
private float _lastKnownFOV = 60f;
|
||||
|
||||
protected override void Awake()
|
||||
@@ -55,7 +53,6 @@ protected override void Start()
|
||||
public override void GetInputAxes(List<IInputAxisOwner.AxisDescriptor> axes)
|
||||
{
|
||||
base.GetInputAxes(axes);
|
||||
axes.Add(new() { DrivenAxis = () => ref AimMode, Name = "Aim" });
|
||||
}
|
||||
|
||||
protected override CinemachineVirtualCameraBase ChooseCurrentCamera(Vector3 worldUp, float deltaTime)
|
||||
@@ -63,10 +60,17 @@ protected override CinemachineVirtualCameraBase ChooseCurrentCamera(Vector3 worl
|
||||
var oldCam = (CinemachineVirtualCameraBase)LiveChild;
|
||||
var newCam = _isAiming ? _aimCamera : _freeCamera;
|
||||
if (_controller != null && oldCam != newCam)
|
||||
{
|
||||
_controller.RotationMode = _isAiming
|
||||
? PlayerCharacterController.PlayerRotationMode.CameraCoupled
|
||||
: PlayerCharacterController.PlayerRotationMode.CameraDecoupled;
|
||||
{
|
||||
//에임모드에서 다시 돌아갈때 플레이어의 현재 회전값에 카메라를 일치시킴
|
||||
if(newCam == _freeCamera)
|
||||
{
|
||||
CinemachineOrbitalFollow orbitalFollow = newCam.GetComponent<CinemachineOrbitalFollow>();
|
||||
|
||||
orbitalFollow.HorizontalAxis.Recentering.Enabled = true;
|
||||
orbitalFollow.VerticalAxis.Recentering.Enabled = true;
|
||||
orbitalFollow.HorizontalAxis.Recentering.Enabled = false;
|
||||
orbitalFollow.VerticalAxis.Recentering.Enabled = false;
|
||||
}
|
||||
_controller.RecenterPlayer();
|
||||
}
|
||||
return newCam;
|
||||
|
||||
Reference in New Issue
Block a user