KNU_SpaceShooter/Assets/02_Scripts/PlayerController.cs

33 lines
676 B
C#
Raw Normal View History

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
Debug.Log("h=" + h + " v=" + v);
2024-09-11 14:07:21 +09:00
2024-09-11 14:02:33 +09:00
transform.Translate(Vector3.forward * 0.01f);
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)
*/