Math
Math functions. Note that parameter types can be either int or float unless otherwise specified. Functions may return int or float depending on the parameter types given.
Fields
PI
float
true
Mathf.PI
Infinity
float
true
Mathf.Infinity
Rad2DegConstant
float
true
Mathf.Rad2Deg
Deg2RadConstant
float
true
Mathf.Deg2Rad
Functions
Clamp(value, min, max)
int/float
Clamps the value between min and max.
Max(a, b)
int/float
Maximum of a and b.
Min(a, b)
int/float
Minimum of a and b.
Pow(a, b)
float
a to the power of b.
Abs(a)
int/float
Absolute value of a.
Sqrt(a)
float
Square root of a.
Mod(a, b)
int
Modulo of a % b
Ceil(a)
int
Rounds to higher int.
Floor(a)
int
Rounds to lower int.
Round(a)
int
Rounds to nearest int.
Sin(a)
float
Sin of a, in degrees.
Cos(a)
float
Cosine of a.
Tan(a)
float
Tan of a.
Asin(a)
float
Arcsin of a, in degrees.
Acos(a)
float
Arccos of a.
Atan(a)
float
Arctan of a.
Atan2(a, b)
float
Atan2 of a and b.
Deg2Rad(a)
float
Converts a degrees to radians.
Rad2Deg(a)
float
Converts a radians to degrees.
Lerp(a, b, t)
float
Linearly interpolates between a
and b
by t
where t
is limited from 0 to 1.
LerpUnclamped(a, b, t)
float
Linearly interpolates between a
and b
by t
with no limit to t
.
Sign(a)
float
Returns a value of 1 when a
is 0 or greater. Returns a value of -1 when a
is negative.
Last updated