FPS๋ ๋ง์ธํฌ๋ํํธ ์ฒ๋ผ 1์ธ์นญ ์์ ์ผ๋ก ๋ค๋๋ ๋ฐฉ๋ฒ์ข์
public class PlayerMove : MonoBehaviour
{
public float Speed;
Rigidbody rigid;
Vector3 moveVec;
void Awake()
{
rigid = GetComponent<Rigidbody>();
}
// Start is called before the first frame update
// Update is called once per frame
void FixedUpdate()
{
float h = Input.GetAxisRaw("Horizontal");
float v = Input.GetAxisRaw("Vertical");
//rigid.AddForce(new Vector3(h, 0, v), ForceMode.Impulse);
moveVec = new Vector3(h, 0, v).normalized;
transform.position += moveVec * Speed * Time.deltaTime;
transform.LookAt(transform.position + moveVec);
}
}
์์๊ป PlayerMove์ ๋๋ค.
์ด๋ ๊ฒ ๋ง๋ค์๋๋ฐ ์,๋ค,์ข,์ฐ ๋ค ๊ฐ๊ธด ๊ฐ๋๋ฐ ๋ฌธ์ ๋ ์ ๊ฐ ์ํ ๋ฐฉ์์ด ์๋๋๋ค. ๊ฒ์ฒ๋ผ ์์ผ๋ก ๊ฑธ์์๋ ์์ ๋ณด๋ฉด์ ๋ค๋ก ๊ฑธ์ ์๋ ์์ต๋๋ค.
FPS, ๋งํฌ ์ฒ๋ผ ํ ์ ์๊ฒ ํด์ฃผ์ธ์. ์๋ง ์นด๋ฉ๋ผ ์ฝ๋ ์ง์ ๋ง์ฐ์ค ์์ง์ด๋ ๋ฐฉํฅ์ ๋ฐ๋ผ ์์ง์ด๊ฒ ํด์ฃผ์ธ์
์ ๋ํฐ์ 3D starter Kit๋ ๋ฌด๋ฃ๋๊น ๊ทธ๊ฑธ๋ก ํด๋ด
๋ฐฅ๋จน์ฌ์ฃผ์ธ์๋ ์ข;; ์ชผ๊ธ๋ง ์๊ฐ ๋ํด๋ณด์