【Unity】Mathfメモ

ひとまず仕事中に出会ったやつをメモ。

 

■Mathf.Clamp

 _position.x = Mathf.Clamp (_position.x, -limitX, limitX);

与えられた最小値と最大値の間に、値を制限する。

 

■Mathf.CeilToInt

 Mathf.CeilToInt (f);

切り上げで整数を返す。

 

■Mathf.FloorToInt

 Mathf.FloorToInt (f);

切り捨てで整数を返す。

 

■Mathf.RoundToInt

 Mathf.RoundToInt (f);

四捨五入で整数を返す。

 

■Mathf.Max

 Mathf.Max (f1, f2);

2つ以上の値から最大値を返す。

 

■Mathf.Min

 Mathf.Min (f1, f2);

2つ以上の値から最小値を返す。

 

■参考

Unity - スクリプトリファレンス: Mathf

 

随時更新していきます。