Unity의 Mathf 클래스는 게임 및 앱 개발에 일반적으로 필요한 삼각 함수, 로그 함수, 기타 함수를 비롯한 일반적인 수학 함수 컬렉션을 제공합니다.
이 페이지는 Mathf 클래스의 개요, 그리고 이 클래스를 사용하는 스크립팅의 일반적인 용도에 대해 설명합니다. Mathf 클래스의 모든 멤버에 대한 전체 레퍼런스는 Mathf 스크립트 레퍼런스를 참조하십시오.
Unity의 모든 삼각 함수는 라디안으로 작동합니다.
PI
는 상수로 사용할 수 있으며, 정적 값 Rad2Deg
또는 Deg2Rad
와 곱하여 라디안과 각도 간에 전환할 수 있습니다.
Unity는 다음과 같은 일반적인 거듭제곱근 및 제곱근을 제공합니다.
- Pow
- Sqrt
- Exp
또한 몇 가지 유용한 2의 거듭제곱 관련 함수도 있습니다. 다음 함수는 종종 2의 거듭제곱 값(예: 텍스처 차원)으로 제한되거나 최적화되는 일반적인 바이너리 데이터 크기로 작업할 때 유용합니다.
Unity의 보간 함수를 사용하면 주어진 두 점 사이의 값을 계산할 수 있습니다. 이러한 각 함수는 상황에 맞게 다른 방식으로 작동합니다. 자세한 내용은 각각의 예제를 참조하십시오.
Lerp
LerpAngle
LerpUnclamped
InverseLerp
MoveTowards
MoveTowardsAngle
SmoothDamp
SmoothDampAngle
SmoothStep
Vector classes 및 Quaternion
클래스는 모두 여러 차원의 포지션, 방향 및 회전을 보간할 수 있는 자체 보간 함수(예: Quaternion.Lerp)를 보유하고 있습니다.
이러한 간단한 헬퍼 함수는 게임이나 앱에서 유용하게 사용되며, 값을 특정 범위로 제한하거나 특정 범위 내에서 반복해야 할 때 시간을 절약할 수 있습니다.
Log
함수를 사용하면 자연 로그 또는 지정된 밑(base)으로 특정 숫자의 로그를 계산할 수 있습니다. 또한 Log10
함수는 특정 숫자의 밑이 10인 로그를 반환합니다.
Mathf 클래스의 전체 함수 리스트는 Mathf 스크립트 레퍼런스를 참조하십시오.
Mathf
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.