magnitude是精确距离,sqrMagnitude是节省CPU的粗略距离,精度有损失

时间:2021-11-24 16:58:42

magnitude是精确距离,sqrMagnitude是节省CPU的粗略距离,精度有损失

CubeA坐标 x:0 y:0.844 z:0

CubeC坐标 x:0 y:0 z:0

Vector3 aaa = A.position - C.position;

Debug.DrawLine(A.position, C.position, Color.green);

Debug.Log("aaa: " + aaa.ToString() + " magnitude:" + aaa.magnitude + " sqrMagnitude:" + aaa.sqrMagnitude);

magnitude是精确距离,sqrMagnitude是节省CPU的粗略距离,精度有损失