---
title: 一般的な数学関数の使用
product: Unity Editor
version: '6000.0'
latest_version: '7000.0'
status: This page documents version 6000.0. The latest version is 7000.0.
canonical: https://docs.unity.com/ja-jp/engine/6000.0/manual/scripting/object-oriented-development/programming-math/class-mathf
latest_url: https://docs.unity.com/ja-jp/engine/7000.0/manual/scripting/object-oriented-development/programming-math/class-mathf.md
generated_at: 2026-11-14T04:39:02.173Z
locale: ja-jp
---

# 一般的な数学関数の使用

> Unity の Mathf クラスを使用して、三角関数、対数的な関数、およびゲーム開発で一般的に必要とされるその他の数学関数を適用できます。

Unity の Mathf クラスは、ゲームやアプリ開発で一般的に必要とされる三角関数、対数的な関数、その他の関数を含む、一般的な数学関数のコレクションを提供します。

このページでは、Mathf クラスの概要と、Mathf クラスを使用してスクリプトを作成する際の一般的な使用方法について説明します。Mathf クラスのすべてのメンバーの詳細なリファレンスについては、[Mathf スクリプト リファレンス](/engine/6000.0/script-reference/unityengine/mathf.md)を参照してください。

## 三角関数##trigonometric

Unity の三角関数はすべて**ラジアン**で動作します。

* [`Sin`](/engine/6000.0/script-reference/unityengine/mathf/sin.md)
* [`Cos`](/engine/6000.0/script-reference/unityengine/mathf/cos.md)
* [`Tan`](/engine/6000.0/script-reference/unityengine/mathf/tan.md)
* [`Asin`](/engine/6000.0/script-reference/unityengine/mathf/asin.md)
* [`Acos`](/engine/6000.0/script-reference/unityengine/mathf/acos.md)
* [`Atan`](/engine/6000.0/script-reference/unityengine/mathf/atan.md)
* [`Atan2`](/engine/6000.0/script-reference/unityengine/mathf/atan2.md)

[`PI`](/engine/6000.0/script-reference/unityengine/mathf/pi.md)は定数として使用でき、静的値[`Rad2Deg`](/engine/6000.0/script-reference/unityengine/mathf/rad2deg.md)または[`Deg2Rad`](/engine/6000.0/script-reference/unityengine/mathf/deg2rad.md)で乗算して、ラジアンと度を変換できます。

## 累乗と正方形根##powers-and-square-roots

Unity は、一般的な累乗および正方形ルート関数を提供します。

* [`Pow`](/engine/6000.0/script-reference/unityengine/mathf/pow.md)
* [`Sqrt`](/engine/6000.0/script-reference/unityengine/mathf/sqrt.md)
* [`Exp`](/engine/6000.0/script-reference/unityengine/mathf/exp.md)

2 のべき乗に関連する便利な関数もあります。これらは、2 の累乗の値 (テクスチャの寸法など) に制約されたされたり最適化されたりすることが多い一般的なバイナリデータサイズを扱う場合に便利です。

* [`ClosestPowerOfTwo`](/engine/6000.0/script-reference/unityengine/mathf/closestpoweroftwo.md)
* [`NextPowerOfTwo`](/engine/6000.0/script-reference/unityengine/mathf/nextpoweroftwo.md)
* [`IsPowerOfTwo`](/engine/6000.0/script-reference/unityengine/mathf/ispoweroftwo.md)

## 補間##interpolation

Unity の補間関数を使用すると、指定した 2 点の間の値を計算できます。これらの関数の動作はそれぞれ異なるため、状況によって異なります。詳細については、それぞれの例を参照してください。

* [`Lerp`](/engine/6000.0/script-reference/unityengine/mathf/lerp.md)
* [`LerpAngle`](/engine/6000.0/script-reference/unityengine/mathf/lerpangle.md)
* [`LerpUnclamped`](/engine/6000.0/script-reference/unityengine/mathf/lerpunclamped.md)
* [`InverseLerp`](/engine/6000.0/script-reference/unityengine/mathf/inverselerp.md)
* [`MoveTowards`](/engine/6000.0/script-reference/unityengine/mathf/movetowards.md)
* [`MoveTowardsAngle`](/engine/6000.0/script-reference/unityengine/mathf/movetowardsangle.md)
* [`SmoothDamp`](/engine/6000.0/script-reference/unityengine/mathf/smoothdamp.md)
* [`SmoothDampAngle`](/engine/6000.0/script-reference/unityengine/mathf/smoothdampangle.md)
* [`SmoothStep`](/engine/6000.0/script-reference/unityengine/mathf/smoothstep.md)

[Vector クラス](/engine/6000.0/manual/scripting/object-oriented-development/programming-math/vectors.md)と [`Quaternion`](/engine/6000.0/manual/working-with-gameobjects/gameobject-fundamentals/rotation-orientation/class-quaternion.md) クラスはすべて、位置、方向、回転を複数の次元で内挿できる独自の補間関数 （クォータニオン.Lerp など） を持っています。

## 値の制限と繰り返し##limiting-and-repeating-values

これらの単純なヘルパー関数は、多くの場合、ゲームやアプリケーションで役立ち、値をある範囲に制限したり、ある範囲内で繰り返したりする必要がある場合に時間を節約できます。

* [](/engine/6000.0/script-reference/unityengine/mathf/max.md) および `Max`。
* [](/engine/6000.0/script-reference/unityengine/mathf/repeat.md) および `Repeat`。
* [](/engine/6000.0/script-reference/unityengine/mathf/clamp.md) および `Clamp`。
* [](/engine/6000.0/script-reference/unityengine/mathf/ceil.md) および `Ceil`。

## 対数的な##logarithmic

[`Log`](/engine/6000.0/script-reference/unityengine/mathf/log.md) 機能を使用すると、 自然対数または指定された底で、 指定された数の対数を計算できます 。さらに、 [`Log10`](/engine/6000.0/script-reference/unityengine/mathf/log10.md) 関数は、 指定された数の 10 を底とする対数を返します 。

## その他の機能##other-functions

Mathf クラスのすべての関数のリストについては、[Mathf スクリプト リファレンス](/engine/6000.0/script-reference/unityengine/mathf.md)を参照してください。
