1.Mathf常量
2.Mathf方法()
//=========================================
1.Mathf常量
print(Mathf.Deg2Rad);//从角度到弧度的转换常数(只读)。不明
print(Mathf.Rad2Deg);//弧度到角度转换常数(只读)。不明
print(Mathf.Infinity);//表示正无穷(只读)。
print(Mathf.NegativeInfinity);//负无穷表示(只读)。
print(Mathf.PI);//臭名昭著的3.14159265358979…值(只读)。
print(Mathf.Epsilon);//一个微小的浮点值(只读)。
2.Mathf方法()
print(Mathf.ClosestPowerOfTwo(1));//返回值最接近的幂。
print(Mathf.Max(2,7));//返回最大值。
print(Mathf.Min(2,7));//返回最小值。
print(Mathf.Pow(2,3));//返回f升为p。2的3次方
print(Mathf.Sqrt(4));//返回根号f。
//=========================================
float newx = Mathf.Lerp(GO.transform.position.x,10,Time.deltaTime);//差值运算,比例运动
//可用于物理动画,渐变或恒定,时间*速度值
newx = Mathf.MoveTowards(GO.transform.position.x,10,Time.deltaTime);//向目标移动一个值电流。
//可用于物理动画,匀速运动,时间*速度值
newx = Mathf.PingPong(Time.time,10);//它的值是t,所以它永远不会大于长度,永远不会小于0。
//0-10往返匀速运动,乒乓运动
GO.transform.position=new Vector3(newx,0,0);//transform坐标移动