Camera &引用;“方向立方体”;三年后
我想用三个JS制作一个方向视图立方体 在使用正交摄影机和正交轨迹球控件的场景中Camera &引用;“方向立方体”;三年后,camera,three.js,Camera,Three.js,我想用三个JS制作一个方向视图立方体 在使用正交摄影机和正交轨迹球控件的场景中 this.rotateViewCube = function (refPoint) { _rotateEnd.copy(refPoint); _this.rotateCamera(); }; 我实际要做的是创建一个ViewCube: gizmoBox = new THREE.Object3D(); for (var x = -1; x <= 1; x+=1) { for (var
this.rotateViewCube = function (refPoint) {
_rotateEnd.copy(refPoint);
_this.rotateCamera();
};
我实际要做的是创建一个ViewCube:
gizmoBox = new THREE.Object3D();
for (var x = -1; x <= 1; x+=1) {
for (var y = -1; y <= 1; y+=1) {
for (var z = -1; z <= 1; z+=1) {
if (/* is a corner coordinate */) {
corner = new THREE.Mesh(...);
...
gizmoBox.add(corner);
} else if (/*is a border coordinate*/) {
edge = new THREE.Mesh( ... );
...
gizmoBox.add(edge);
} else if (/*is a side coordinate */) {
side = new THREE.Mesh(...)
...
gizmoBox.add(side);
/*here, i added some text : FRONT, BACK, ...*/
}
}
}
}
然后我想使用ViewCube的每个部分的位置(缩放之前)作为场景中的“参考点”进行旋转。所以我在正交轨迹球控件中添加了这个函数
this.rotateViewCube = function (refPoint) {
_rotateEnd.copy(refPoint);
_this.rotateCamera();
};
但它不能正常工作,相机移动了,但不像我预期的那样。作为一个想法的人?我自己找到了一个解决方案 我从ViewCube的单击部分获取“参考点”,然后修改正交轨迹球控件中的默认相机位置(由位置0引用)。最后我重置了它
var position = intersects[0].object.refPoint;
controls.position0.copy(position);
controls.reset();