我有一个位置向量:
var startPos = new THREE.Vector3(1.2, -2.34, 0.5);
方向向量:
var direction = new THREE.Vector3(0.657873735, -0.2497291683, 0.71051916);
距离:
var distance = 1;
如何计算一个新的位置向量,从startPos
开始,沿着方向
移动距离
?
最佳答案
var startPos = new THREE.Vector3(1.2, -2.34, 0.5);
var direction = new THREE.Vector3(0.6578737359955765, -0.24972916834682138, 0.710519166466616);
var distance = 1;
var newPos = new THREE.Vector3();
newPos.addVectors ( startPos, direction.multiplyScalar( distance ) );
关于三.JS:获取沿方向向量的位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29183132/