API:Vector3 Vector2=vector1.normalized;
代码实现:
//方向
void Demo02(http://www.amjmh.com/v/BIBRGZ_558768/)
{
Vector3 pos = this.transform.position;
Debug.DrawLine(Vector3.zero, this.transform.position);
//数学公式
Vector3 dir1 = pos / pos.magnitude;
//UnityAPI 封装好的方法
Vector3 dir2 = pos.normalized;
Debug.DrawLine(Vector3.zero,dir1,Color.red);
}
---------------------