ย  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);


์ด ์ฝ”๋“œ๋กœ ์ˆ˜ํ‰ ์ด๋™ ๊ตฌํ˜„ํ•˜๊ณ  ์žˆ๋Š”๋ฐ

์ข…์ข… ๋ฐฉํ–ฅํ‚ค๋ฅผ ๊ณ„์† ๋ˆŒ๋Ÿฌ๋„ ์ผ์‹œ์ •์ง€ํ•˜๋Š” ์ด์Šˆ๊ฐ€ ์žˆ์Œ

๋ช‡ ๋ฒˆ ๋‹ค์‹œ ๋ˆ„๋ฅด๋ฉด ๋˜๊ธด ํ•˜๋Š”๋ฐ ์ด์œ ๊ฐ€ ๋ญ˜๊นŒ