我可以使用 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);
Run Code Online (Sandbox Code Playgroud)
但现在我希望锥体能够平稳、缓慢地从旧目标平移到新目标。我想我可以通过计算以圆锥中心 Cxyz 为中心并从先前目标位置 Pxyz 到新目标位置 Nxyz 的圆弧上的中间点来实现。
请有人给我指出合适的:(a) 实用程序或 (b) 三角算法或 (c) 用于计算此类弧上中间点的 xyz 坐标的代码示例?(我将根据所需的扫描速率和帧之间的时间间隔提供点之间的角度增量)。