This commit is contained in:
LeeJaeHyun 2024-09-11 14:45:03 +09:00
parent f8ca1e1eee
commit 16f9db5942
2 changed files with 5 additions and 1 deletions

View File

@ -732,6 +732,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 22f91d763663a4c6290b8d64b02ce4c7, type: 3} m_Script: {fileID: 11500000, guid: 22f91d763663a4c6290b8d64b02ce4c7, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
moveSpeed: 8
--- !u!1001 &1157015548 --- !u!1001 &1157015548
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -6,8 +6,10 @@ public class PlayerController : MonoBehaviour
{ {
private float h; private float h;
private float v; private float v;
private float r;
public float moveSpeed = 5.0f; [SerializeField] private float moveSpeed = 5.0f;
[SerializeField] private float turnSpeed = 200.0f;
void Start() void Start()
{ {
@ -18,6 +20,7 @@ public class PlayerController : MonoBehaviour
{ {
h = Input.GetAxis("Horizontal"); // 1차원 연속값 -1.0 ~ 0.0 ~ +1.0 h = Input.GetAxis("Horizontal"); // 1차원 연속값 -1.0 ~ 0.0 ~ +1.0
v = Input.GetAxis("Vertical"); // -1.0f ~ 0.0f ~ +1.0f v = Input.GetAxis("Vertical"); // -1.0f ~ 0.0f ~ +1.0f
r = Input.GetAxis("Mouse X"); // 마우스의 X축 이동 변위값(Delta Value)
// 벡터의 덧셈연산 => 벡터의 정규화 (Vector Normalized) // 벡터의 덧셈연산 => 벡터의 정규화 (Vector Normalized)
Vector3 moveDir = (Vector3.forward * v) + (Vector3.right * h); Vector3 moveDir = (Vector3.forward * v) + (Vector3.right * h);