210711
unity_beginner #8
Input.GetAxis("");
-> "" 내에 Horizontal, Vertical 화살표 입력시 1단위로 값을 받는다.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Ground : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
float zRotation = transform.localEulerAngles.z;
zRotation = zRotation - Input.GetAxis("Horizontal");
transform.localEulerAngles = new Vector3(10, 0, zRotation);
}
}
Horizontal -> 수평값 -> 입력시 ground가 회전하도록 하였다.