2024-09-11 13:45:36 +09:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
public class PlayerController : MonoBehaviour
|
|
|
|
{
|
2024-09-11 14:05:43 +09:00
|
|
|
private float h;
|
|
|
|
private float v;
|
|
|
|
|
2024-09-11 13:45:36 +09:00
|
|
|
void Start()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void Update()
|
|
|
|
{
|
2024-09-11 14:08:25 +09:00
|
|
|
h = Input.GetAxis("Horizontal"); // 1차원 연속값 -1.0 ~ 0.0 ~ +1.0
|
2024-09-11 14:12:27 +09:00
|
|
|
v = Input.GetAxis("Vertical"); // -1.0f ~ 0.0f ~ +1.0f
|
2024-09-11 14:18:23 +09:00
|
|
|
// Debug.Log("h=" + h + " v=" + v);
|
|
|
|
Debug.Log($"h={h} / v={v}");
|
2024-09-11 14:07:21 +09:00
|
|
|
|
2024-09-11 14:19:48 +09:00
|
|
|
transform.Translate(Vector3.forward * v * 0.05f);
|
|
|
|
transform.Translate(Vector3.right * h * 0.05f);
|
2024-09-11 13:45:36 +09:00
|
|
|
}
|
|
|
|
}
|
2024-09-11 13:48:55 +09:00
|
|
|
|
|
|
|
/*
|
|
|
|
Vector3.forward = Vector3(0, 0, 1)
|
|
|
|
Vector3.up = Vector3(0, 1, 0)
|
|
|
|
Vector3.right = Vector3(1, 0, 0)
|
|
|
|
|
|
|
|
Vector3.one = Vector3(1, 1, 1)
|
|
|
|
Vector3.zero = Vector3(0, 0, 0)
|
|
|
|
*/
|