์ผ๋จ ์ฝ๋ ๋จผ์
ย private void Move()
ย ย {
ย ย ย ย float horizontal = Input.GetAxis("Horizontal");
ย ย ย ย float vertical = Input.GetAxis("Vertical");
ย ย ย ย Vector3 moveInput = new Vector3(horizontal, 0, vertical).normalized;
ย ย ย ย characterController.SimpleMove(moveInput * speed);
ย ย }
void Rotation()
ย ย {
ย ย ย ย if (characterController.velocity.magnitude <= 0.01f) return;
ย ย ย ย float yawCamera = cam.transform.rotation.eulerAngles.y;
ย ย ย ย transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.Euler(0, yawCamera, 0), turnSpeed * Time.deltaTime);
ย ย }
์บ๋ฆญํฐ ์ ํ์ข์ฐ ์ด๋์ ๋ฌธ์ ๊ฐ ์๋๋ฐ
๋ง์ฐ์ค ์ด๋์ ๋ฐ๋ผ์ ์นด๋ฉ๋ผ๊ฐ ๊ฐ์ด ํ์ ํ๊ณ
์บ๋ฆญํฐ ํ์ ๋ ์นด๋ฉ๋ผ ํ์ ์ด๋ ๊ฐ๊ฒ ํด๋์
๊ทผ๋ฐ ์บ๋ฆญํฐ๋ฅผ ์ค์ ๋ก ํ์ ์์ผ๋ณด๋ฉด
wasd๋ฅผ ๋๋ ์ ๋ย ๋ง์น ํ์ ํ๊ธฐ ์ ์ฒ๋ผ ์์ง์
์์์์๋ ๋ณด๋ฉด ์บ๋ฆญํฐ ํ์ ํ์ wasd๋ฅผ ๋๋ ์ ๋
w ๋๋ฅด๋ฉด ์ ์ง์ด ์๋๋ผ ์ข๋ก๊ฐ๊ณ
s ๋๋ฅด๋ฉด ํ์ง์ด ์๋๋ผ ์ฐ๋ก ๊ฐ๋ฒ๋ฆฌ๋ค
๋ง์น ์บ๋ฆญํฐ forward๊ฐ ์์ ์ ๋ฐ๋๊ฒ์ฒ๋ผ ์์ง์ด๋๋ฐ
์ด๊ฑฐ ์ด์ผ ํด๊ฒฐํ ์์๋์ง..
transform.right๋ฅผ ์ด์ฉํด์ ํ์ ๋ ๋ฌผ์ฒด์ ์ค๋ฅธ์ชฝ ๋ฒกํฐ๊ฐ์ ๊ฐ์ ธ์ฌ์ ์์. ์ด๊ฑธ ์ด์ฉํด๋ณด๋๊ฑด ์ด๋ฐ