2026-03-16 FPS 스타일의 정면 고정 이동 80%

This commit is contained in:
2026-03-16 04:22:33 +09:00
parent 56e9d97827
commit 9171033db8
39 changed files with 8152 additions and 329 deletions

View File

@@ -214,7 +214,7 @@ private void Movement()
_moveTargetDir = _dodgeDir * _currentSpd;
// 구르기 중엔 즉시 회전 (선택 사항)
transform.rotation = Quaternion.LookRotation(_dodgeDir);
//transform.rotation = Quaternion.LookRotation(_dodgeDir);
return;
}
@@ -233,6 +233,8 @@ private void Movement()
_anim.SetFloat("speedRatio", _currentSpd / _spdCoefficient);
Vector3 camForward = Camera.main.transform.forward; //메인카메라의 로컬기준 앞쪽방향
camForward.y = 0; //높이를 무시하기 위해 0으로
camForward.Normalize();
@@ -245,7 +247,16 @@ private void Movement()
_moveTargetDir = (moveDir.x * camRight + moveDir.z * camForward) * _currentSpd;//오른쪽을 눌렀다면 camRight 방향으로 그만큼, 위쪽을 눌렀다면 camForward방향으로 그만큼 가라
RotationByMove();
//방향키 방향으로 회전하며 이동
//RotationByMove();
Debug.Log($"Forward : {camForward}");
//카메라가 보는 방향으로 회전
RotationByVector(camForward);
_anim.SetFloat("DirectX", moveDir.x * _currentSpd / _spdCoefficient);
_anim.SetFloat("DirectY", moveDir.z * _currentSpd / _spdCoefficient);
}
private void RotationByMove()
{
@@ -255,6 +266,10 @@ private void RotationByMove()
transform.rotation = Quaternion.Slerp(transform.rotation, lookTarget, Time.deltaTime * 10);
}
}
private void RotationByVector(Vector3 dir)
{
transform.forward = Vector3.Slerp(transform.forward, dir, Time.deltaTime * 10);
}
#endregion
#region