์์ ์ค๋ธ์ ํธ๋ ๋ถ๋ชจ ์์ง์์ ๋ฐ๋ผ๊ฐ์ ๋ฐ๋ก ํ์ ๋ ์ค์ ์ ํด๋ ๋๋๊ฑธ๋ก ์๊ณ ์๋๋ฐ์...
์์ ์คํ ์ด์์ ๋ค์ด๋ฐ์ ๋ชจ๋ธ์ ์์์ผ๋ก ํด์ ์ ์ฉํ๋๋ฐ, ์ด๋ํค๋ฅผ ์ด์ฉํด์ ์ด๋ ๋ฐฉํฅ์ผ๋ก ์ด๋ํด๋ rotation๊ฐ์ด ๋ฐ๋์ง ์์ต๋๋ค....
์ฌ์ฉํ ๋ชจ๋ธ์ ์๋ ๋งํฌ๊ณ ์
https://assetstore.unity.com/packages/3d/the-realtime-rascals-191779
๋ถ๋ชจ ์ค๋ธ์ ํธ์ ์ฐ๊ฒฐ์ํจ ์คํฌ๋ฆฝํธ ๋ด ์ด๋ ๋ฉ์๋๋ ํน์๋ ํด์ ์ฌ๋ฆฝ๋๋ค...
ย ย void Move()ย ย // ํ๋ ์ด์ด ์ด๋
https://assetstore.unity.com/packages/3d/the-realtime-rascals-191779
The Realtime Rascals | 3D | Unity Asset StoreElevate your workflow with The Realtime Rascals asset from Unity Technologies. Find this & other great 3D options on the Unity Asset Store.assetstore.unity.comย ย ย ย float horizontal = Input.GetAxisRaw("Horizontal");
ย ย ย ย Vector3 moveDirection = new Vector3(0, 0, -horizontal);
ย ย ย ย transform.Translate(moveDirection * moveSpeed * (wDown ? 0.1f : 1) * Time.deltaTime);
ย ย ย ย //transform.rotation = Quaternion.LookRotation(moveDirection); ->์ด๋ฐฉ๋ฒ ์จ๋ ์๋จ
ย ย ย ย transform.Rotate(moveDirection * Time.deltaTime);ย ย ย //์ด๋ฐฉ๋ฒ๋ ์๋จ
ย ย }
๋ฆฌ์ง๋๋ฐ๋ Kinematic ํ์ธํด๋ณด์
๋ถ๋ชจ ์ค๋ธ์ ํธ์ Is kinematic์ ์กฐ์ ํ๋ ๊ฒ ๋ง๋์? ์ฐ์ ์ฒดํฌ ํด์ ๋์ด์๊ธธ๋ ์ฒดํฌํด๋ดค๋๋ฐ ๋ณ ์ฐจ์ด๋ ์์ต๋๋ค..
์์ ๋ค์ด ๋ฐ์์ ์์์ผ๋ก ๋ฃ๊ณ ๋ ์ฝ๋๋ก ํ๋๋ฐ ํ์ ์๋ง ํ๋๋ฐ? transform์์ ์๋ณํ๋๊ฑฐ ํ์ธํ๊ฑฐ ๋ง์? ์ก์์ผ๋ก ๋์ถฉ๋ณธ๊ฑฐ ์๋? moveDirection๊ฐ ์ ๊ทํ ๋๊ฑฐ๋ผ ๋์๋ดค์ 1์ธ๋ฐ
transform.localRotation