Three.js 计算两点的距离

方法:

.distanceTo ( v : Vector3 ) : Float

计算该向量到所传入的v间的距离。

示例:

var pos1 = new THREE.Vector3( 0, 1, 0 );

var pos2 = new THREE.Vector3( 1, 1, 1);

var distance = pos1.distanceTo(pos2);

 

你可能感兴趣的:(Three.js,webgl)