计算 3d 空间中特定距离的两点之间的点

pia*_*aac 1 javascript math 3d three.js

对于 Three.js 中的相机移动,我需要计算 pointC以便将相机从 point 移动A到一定距离dist到 point B

显示要查找的点的方案

Wes*_*ley 5

Three.js 有很容易做到这一点的方法。

假设abc是 的实例THREE.Vector3()

a.set( 2, 1, 4 );
b.set( 9, 4, 2 );

c.subVectors( a, b ).setLength( dist ).add( b );
Run Code Online (Sandbox Code Playgroud)

三.js r.91