Files
SHI-Cesium/Assets/Scripts/Test/SimpleTestCamera.cs
2025-09-15 21:20:09 +09:00

29 lines
838 B
C#

using UnityEngine;
public class SimpleTestCamera : MonoBehaviour
{
private float moveSpeed = 100f; // 이동 속도
private float fastMultiplier = 3f; // Shift 키 누르면 빠르게
void Update()
{
// 기본 입력 (WASD)
float h = Input.GetAxisRaw("Horizontal"); // A(-1), D(+1)
float v = Input.GetAxisRaw("Vertical"); // W(+1), S(-1)
// 높낮이 입력 (Q/E)
float y = 0f;
if (Input.GetKey(KeyCode.Q)) y = -1f; // 아래로
if (Input.GetKey(KeyCode.E)) y = 1f; // 위로
// 이동 벡터 (월드 좌표 기준)
Vector3 move = new Vector3(h, y, v).normalized;
// Shift 키 가속
float speed = moveSpeed * (Input.GetKey(KeyCode.LeftShift) ? fastMultiplier : 1f);
// 최종 이동
transform.position += move * speed * Time.deltaTime;
}
}