Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Three.js 创建具有正确旋转的箭头辅助对象_Three.js - Fatal编程技术网

Three.js 创建具有正确旋转的箭头辅助对象

Three.js 创建具有正确旋转的箭头辅助对象,three.js,Three.js,如何在Three.js(r58)中创建旋转正确的箭头辅助对象 var point1 = new THREE.Vector3(0, 0, 0); var point2 = new THREE.Vector3(10, 10, 10); var direction = new THREE.Vector3().subVectors(point1, point2); var arrow = new THREE.ArrowHelper(direction.normalize(), point1); cons

如何在Three.js(r58)中创建旋转正确的箭头辅助对象

var point1 = new THREE.Vector3(0, 0, 0);
var point2 = new THREE.Vector3(10, 10, 10);
var direction = new THREE.Vector3().subVectors(point1, point2);
var arrow = new THREE.ArrowHelper(direction.normalize(), point1);
console.log(arrow.rotation);

我总是以
对象{x:0,y:0,z:0}
结束箭头旋转。我做错了什么?

ArrowHelper
使用四元数指定其方向

如果您这样做:

var rotation = new THREE.Euler().setFromQuaternion( arrow.quaternion );
您将看到以Euler角表示的等效方向,但在r.59中,
箭头。旋转现在自动更新,因此您将不再看到零


编辑:答案更新为three.js r.59

我只是想补充一点,我正在尝试类似的东西,但似乎ArrayHelper.var direction=new three.Vector3().subVectors(点2,点1)上不再设置旋转;非常感谢,它工作得很好。还为旧问题添加了一个答案。