Mathf中常用的方法
Mathf.ColsestPowerOfTwo(10)返回最接近的 2 的幂值(2的平方值)
Marhf.deltaAngle(1080,90) 计算两个角度之间的最小夹角。
Mathf.Floor(10.7);向下取整, FloorToInt,返回int类型
mathf.Exp(n) 代表e的n次方。
public static float Lerp (float a, float b, float t);
在 a 与 b 之间按 t 进行线性插值。
参数 t 限制在范围 [0, 1] 内。
当 t = 0 时,返回 t。\ 当 t = 1 时,返回 t。\ 当 t = 0.5 时,返回 a 和 b 的中点。
public static float LerpAngle (float a, float b, float t);
与 Lerp 相同,但是在值环绕 360 度时确保值正确插入。
参数 t 限制在范围 [0, 1] 内。假设变量 a 和 b 以度为单位。
public static float LerpUnclamped (float a, float b, float t);
t不受限制。想是多少是多少。
Mathf.Max(1,2)取得最大值。可以是两个数,可以是数组里的。
Mathf.Min(1,2)取得最小值,范围和max一样
Mathf.MoveToWards(float current, float target, float maxDelta) 用来做移动。将值 current 向 target 靠近。这本质上与 Mathf.Lerp 相同,
Mathf.Pow(float f,flaot p) 取得f的p次方
Mathf.Sqrt() 求平方根