using System.Numerics; using TreeEditor; using UnityEngine; using Quaternion = UnityEngine.Quaternion; using Vector3 = UnityEngine.Vector3; public class PlayerController : MonoBehaviour { [SerializeField] float _speed = 10.0f; void Start() { } float _yAngle = 0.0f; void Update() { _yAngle += Time.deltaTime * 100.0f; // 절대 회전값 지정해서 회전 // transform.eulerAngles = new Vector3(0.0f, _yAngle, 0.0f); // +- delta 값을 특정 축으로 회전 // transform.Rotate(new Vector3(0.0f, Time.deltaTime * 100.0f, 0.0f)); // transform.rotation = Quaternion.Euler(new Vector3(0.0f, _yAngle, 0.0f)); if (Input.GetKey(KeyCode.W)) { transform.rotation = Quaternion.LookRotation(Vector3.forward); // transform.Translate(Vector3.forward * Time.deltaTime * _speed); } if (Input.GetKey(KeyCode.S)) { transform.rotation = Quaternion.LookRotation(Vector3.back); // transform.Translate(Vector3.back * Time.deltaTime * _speed); } if (Input.GetKey(KeyCode.A)) { transform.rotation = Quaternion.LookRotation(Vector3.left); // transform.Translate(Vector3.left * Time.deltaTime * _speed); } if (Input.GetKey(KeyCode.D)) { transform.rotation = Quaternion.LookRotation(Vector3.right); // transform.Translate(Vector3.right * Time.deltaTime * _speed); } } }