-
[unity - mathf] clamp에 관하여 (요약)unity 2022. 4. 1. 11:59
clamp는 mathf로 사용할 수 있으며
최대/최소값 사이의 float 값이 value 범위 외의 값이 되지 않도록 한다.
사용법
public class ExampleClass : MonoBehaviour { void Update() { transform.position = new Vector3(Mathf.Clamp(transform.position.y, 1.0F, 3.0F); } void Update() { 새로운 포지션 변수 = 백터 3 생성(Mathf.Clamp(y축 값, float형, float형); }
'unity' 카테고리의 다른 글
[unity] - [System.Serializable]은? (0) 2022.04.17 [unity - c#] : MonoBehaviour은 왜 있는 거지? (0) 2022.04.17 [Unity(c#) - instance] 단순하게 생각하기 (0) 2022.04.08 [unity - particle system] renderer cube가 제대로 안될 때 (0) 2022.03.30 Instantiate란 (0) 2022.03.30