You can define a rotation from two unit-length vectors v1 and v2 like so:var quaternion = new THREE.Quaternion(); // create one and reuse itquaternion.setFromUnitVectors( v1, v2 );就您而言,您需要先对向量进行归一化.In your case, you need to normalize your vectors first.然后,您可以使用以下模式将该旋转应用于对象:You can then apply that rotation to an object using the following pattern:var matrix = new THREE.Matrix4(); // create one and reuse itmatrix.makeRotationFromQuaternion( quaternion );object.applyMatrix( matrix );或者,如果你不需要矩阵,你可以直接应用四元数:Alternatively, if you do not require the matrix, you can just apply the quaternion directly:object.applyQuaternion( quaternion );three.js r.86three.js r.86 这篇关于如何在 THREE.js 中找到两个向量之间的旋转矩阵的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
07-13 19:11