ย float x = Input.GetAxis("Horizontal");
ย ย ย ย // ๊ฐ์๋ ๊ฐ๋
ย ย ย ย if (canMove)
ย ย ย ย ย ย rb.AddForce(new Vector2(x, 0) * moveSpeed);
ย ย ย ย // ์ต๊ณ ์๋ ์ ํ
ย ย ย ย if (rb.velocity.x > maxSpeed)
ย ย ย ย ย ย rb.velocity = new Vector2(maxSpeed, rb.velocity.y);
ย ย ย ย else if (rb.velocity.x < -maxSpeed)
ย ย ย ย ย ย rb.velocity = new Vector2(-maxSpeed, rb.velocity.y);
์ด ์ฝ๋๋ก ์ํ ์ด๋ ๊ตฌํํ๊ณ ์๋๋ฐ
์ข ์ข ๋ฐฉํฅํค๋ฅผ ๊ณ์ ๋๋ฌ๋ ์ผ์์ ์งํ๋ ์ด์๊ฐ ์์
๋ช ๋ฒ ๋ค์ ๋๋ฅด๋ฉด ๋๊ธด ํ๋๋ฐ ์ด์ ๊ฐ ๋ญ๊น
canMove์กฐ๊ฑด ๊ฑธ๋ฆฐ๊ฑฐ์๋?
ํน์... ์ธํ์ fixedUpdate์ ๋ฃ์ผ์ ๊ฒ๋๊น?
ํด๋น ๋๊ธ์ ์ญ์ ๋์์ต๋๋ค.
๋ง์ y๋ก ํด์ผ์ง
์ค๋ง ๋ฐ์ค์ฝ๋ผ์ด๋ ์๊ตฌ๋ฆฌ๊ฐ ๊ฑธ๋ฆฌ๋ ๊ณ ๋ฐ ๊ฑด ์๋๊ฒ ์ง
๋ฐ๋ฅํ์ผ ์ฝ๋ฆฌ๋์ ๊ฑธ๋ฆฐ๋ค๊ฑฐ๋
๋๋ฒ๊น ์ข ํด๋ผ..