【发布时间】:2015-07-29 08:17:26
【问题描述】:
我可以使用 THREE.js 的“lookAt”函数让我的锥体依次指向每个目标球体(红、绿、黄、蓝)。
// Initialisation
c_geometry = new THREE.CylinderGeometry(3, 40, 120, 40, 10, false);
c_geometry.applyMatrix( new THREE.Matrix4().makeRotationX( Math.PI / 2 ) );
c_material = new THREE.MeshNormalMaterial()
myCone = new THREE.Mesh(c_geometry, c_material);
scene.add(myCone);
// Application (within the Animation loop)
myCone.lookAt(target.position);
但现在我希望圆锥从旧目标平稳缓慢地平移到新目标。我想我可以通过计算圆弧上的中间点来做到这一点,该圆弧以圆锥中心 Cxyz 为中心,从先前的目标位置 Pxyz 传递到新的目标位置 Nxyz。
请有人指出合适的:(a) 实用程序或 (b) 三角算法或 (c) 用于计算此类弧上中间点的 xyz 坐标的代码示例? (我将根据所需的扫描速率和帧之间的时间间隔提供点之间的角度增量)。
【问题讨论】:
标签: javascript three.js