[UNITY] Mathf 주요 기능 정리 (Unity 수학 라이브러리) 🔹 Mathf 주요 기능 정리 (Unity 수학 라이브러리)Mathf는 게임 개발에서 자주 사용하는 수학 함수를 제공하는 Unity의 정적 클래스다🔥 1. 반올림 및 변환 함수함수설명예제 (입력 → 결과)Mathf.CeilToInt올림 후 int로 변환2.3 → 3, -1.7 → -1Mathf.FloorToInt내림 후 int로 변환2.9 → 2, -1.2 → -2Mathf.RoundToInt반올림 후 int로 변환2.5 → 3, 2.4 → 2Mathf.Abs절댓값Mathf.Abs(-5) → 5Mathf.Sign부호 반환 (1 또는 -1)Mathf.Sign(-10) → -1 ✅ 사용 예제int roundedValue = Mathf.RoundToInt(2.6f); // 3int floorValue =.. 2025. 2. 17. [unity] Mathf 올림, 내림, 반올림 🔹 Mathf.CeilToInt vs. Mathf.FloorToInt vs. Mathf.RoundToInt함수동작 방식예제(2.3f)예제(-2.3f)Mathf.CeilToInt올림3-2Mathf.FloorToInt내림2-3Mathf.RoundToInt반올림2-2🔹 언제 사용할까?페이지 스크롤, 이동 거리, 점수 계산 등 2025. 2. 17. 이전 1 다음