如何获得rotation.y&仅旋转.z(rotation.x = 0)使objet看起来像vector3?
答案 0 :(得分:0)
答案 1 :(得分:0)
我这样解决了: (基于这篇文章:3D Vector (X, Y, Z) look at Vector)
var vec3 = new THREE.Vector3(100, 0, 50);
var xzdistance = Math.sqrt(vec3.x * vec3.x + vec3.z * vec3.z);
var rotationY = Math.atan2(vec3.x, vec3.z) + Math.PI /2;
var rotationZ = -Math.atan2(vec3.y, xzdistance);