vector3
成员变量:
x 、 y 、 z .
normalized 得到单位化后的向量【只读】
magnitude 得到向量长度 【只读】
sqrMagnitude 得到向量长度的平方 【只读】
forward 前方
常用方法:
Cross 向量差乘
Dot 向量点乘
Project 计算向量在另一个向量上的投影
Angle 返回2个向量之间的夹角
Distance 返回2个向量之间的距离 Vector3.Distnce(other.position , translation.position);
向量 + - * \ == !=
public Vector3 direction = Vector3.forward; //移动方向
transform.position += direction * speed * Time.deltaTime; //移动坐标
sqrLen = (other.position - tansform.position).sqrMagintude; 计算距离的速度更快(距离的平方)
public transform start;
punlic transform end;
transform.position = Vector3.Lerp( start.position , end.position , Time.time); //从Start 移动到End