无意间查了一下Vector3的API,发现了一个方法。
magnitude Returen the length of vector(Read Only).
然后就试了一下这个方法。
Vector3 P1 = new Vector3(1,1,1);
Vector3 P2 = new Vector3(2,2,2);
print((P1-P2).magnitude);
输出的是1.732。。。。
Unity两点距离的计算
猜你喜欢
转载自blog.csdn.net/meiyoushenmedabuliao/article/details/79114480
今日推荐
周排行