Unity. Mathf.Clamp() μ¬μ©νκΈ°
π Mathf.Clamp()Permalink
μ΅μκ°κ³Ό μ΅λκ°μ μ ν΄μ κ·Έ μμ λ€μ΄ μλ κ°μΈμ λ€λ₯Έ κ°μ΄ λμ§ μκ² νλ€.
π μ¬μ©λ²Permalink
float min = 10f;
float max = 20f;
float pointX = Mathf.Clamp(Input.mousePosition.x, min, max);
Mathf.Clamp()λ value, min, max μμλ‘ μΈμλ₯Ό λ£μ΄μΌ νλ©°, value κ°μ΄ minκ³Ό max μ¬μ΄μ μμΌλ©΄ value κ°μ, μ¬μ΄μ μλ€λ©΄ min λλ maxλ₯Ό λ°ννλ€.
μ μ½λλ λ§μ°μ€μ x μ’νμ λ°λΌ minκ³Ό max μ¬μ΄μ κ°μ λ°ννλ€.
λκΈλ¨κΈ°κΈ°