OnJump ๊ฐ์ ๊ฒฝ์ฐ๋ Button ํ์ ์ธํ์
๊ทธ๋ฐ๋ฐ OnMove, OnJump ๊ฐ์ ํ๋ ์ด์ด ์ธํ ๊ด๋ จ ํจ์ ์์์๋ ๋ฆฌ์ง๋๋ฐ๋๊ฐ ์๋๋๋ผ๊ณ
์ด๋ป๊ฒ ํด์ผ OnJump๋ฅผ ๋ฐ๋ํ์ ๋, Fixed์ ์๋ AddForce๋ฅผ ๋ฐ๋์ํฌ ์ ์์๊น?
if (Input.GetButtonDown(KeyCode.Space))
{
rigid.AddForce(Vector2.up);
}
์ด๋ฐ ๋ฐฉ์์ ์๋จ.ย ํ๋ ์ด์ด ์ธํ์ ์ฐ๋ฉด ์๋ ์ฐ๋ ๋ฐฉ์์ผ๋ก๋ ํค์ ๋ ฅ์ด ์๋ฐ์์ง๋๋ผ๊ณ
ํ์ ๊ฐํ์ง๋ง fixedUpdate์์ velocity๋ฅผ ์๋ก ์ ํด์ค์ ๊ทธ๋ฐ ๊ฒ ๊ฐ์๋ฐ
์ฌํผ ์ํ๋ฅผ ๋๋๋ ๋ฐฉ์์ด ๊ณ ๋ คํด๋ณผ๋งํ๋ฏ
bool ๊ฐ์๊ฑธ ์ด์ฉํด์?