void Start(){
Mathf.Deg2Rad;
Mathf.Rad2Deg;//与float数相乘
Mathf.PI;
Mathf.Infinity;//无穷大
Mathf.NegativeInfinity;//无穷小
Mathf.Epsilon;//非常小的正数;、
Mathf.Abs;//取绝对值
Mathf.Ceil(10.0f);//向上取整,d但取的是浮点数。例如10.0f取10.0f;10.1f取11.0f;
Mathf.CeilTolnt(10.0f);//向上取整;取的int类型;
Mathf.Floor();
Mathf.FloorToInt();//向下取整;
Mathf.Clamp(hp,0,100);//夹逼准则有点像,Mathf.Clamp(hp,0,100);hp的值只能在0到100之间取;包括端点;
Mathf.Clamp01(hp);//Mathf.Clamp(hp);把hp限定在0和1之间;包括端点
Mathf.ClosestPowerOfTwo(h);//取离h最近的2的整次方数,h=1时取0;
Mathf.pow(f,p);//f的p次方;
Mathf.Sqrt(h);//h的平方根;
Mathf.Lerp(a,10,0.1f);//差值运算。在a的基础上加上a到10之间的距离的0.1;
Mathf.MoveTowards(10,20,a);//在10的基础上加上a;但保证10+a小于等于20;
Mathf.PingPong(Time.time*speed,20);//不好解释,这个是以速度speed在0到20之间匀速变化
}
在这里插入代码片
Mathf的重要内容
最新推荐文章于 2024-07-10 09:06:58 发布