유니티 짤막메모

C# 짧 Mathf.Round값 반올림 & 반내림

WMG1 2023. 1. 20. 15:58
반응형

Mathf.Round

반올림 반내림

말그대로 반올림 반내림 계산해주는 코드

float값이 들어가면 곤란한 값에 사용해주면 좋을듯




EX)
//실제 맞은 위치값을 1단위로 움직이게 함 ((단 y는 0.1 단위로 움직임))
_location.Set(Mathf.Round(_location.x), Mathf.Round(_location.y / 0.1f) * 0.1f, Mathf.Round(_location.z));







추후 Mathf 메모를 따로 만들어서 모아놔야겠음

반응형