我有一个 collada 模型,我想以这样的方式定位自己,使其指向它正在移动的方向。
我已经尝试过这个答案中概述的方法,但它不适用于我的情况。我也尝试过使用 Oject3D 类的 lookAt 方法来获得模型的正确方向,但这也不起作用。
//x, y z are position vectors; vx, vy, vz are velocity vectors
//So every iteration I check where the object will be the next iteration
//to get it point in that direction
//Approach number 1
obj.quaternion.setFromUnitVectors (
new THREE.Vector3(x, y, z),
new THREE.Vector3(x + vx, y + vx, z + vz)
);
//Approach number 2
obj.lookAt(new THREE.Vector3(x + vx, y + vx, z + vz));
显然我错过了一些东西。需要帮助!